本文整理汇总了C#中Microsoft.Cci.ModuleIdentity类的典型用法代码示例。如果您正苦于以下问题:C# ModuleIdentity类的具体用法?C# ModuleIdentity怎么用?C# ModuleIdentity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleIdentity类属于Microsoft.Cci命名空间,在下文中一共展示了ModuleIdentity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetModuleStore
ModuleStore GetModuleStore(ModuleIdentity moduleIdentity) {
Contract.Requires(moduleIdentity != null);
Contract.Ensures(Contract.Result<ModuleStore>() != null);
IName moduleName = moduleIdentity.Name;
foreach (ModuleStore mStore in this.ModuleHashtable.GetValuesFor((uint)moduleName.UniqueKey)) {
if (moduleIdentity.Equals(mStore.ModuleIdentitity)) return mStore;
}
uint value;
if (moduleIdentity.ContainingAssembly != null) {
AssemblyStore assemblyStore = this.GetAssemblyStore(moduleIdentity.ContainingAssembly);
assemblyStore.InternedIdWithCount++;
value = assemblyStore.InternedIdWithCount;
} else {
value = this.CurrentModuleInternValue++;
}
ModuleStore mStore1 = new ModuleStore(moduleIdentity, value, this.CurrentNamespaceInternValue++);
this.ModuleHashtable.Add((uint)moduleName.UniqueKey, mStore1);
return mStore1;
}
示例2: ResolvingModuleReference
/// <summary>
/// This method is called when the module reference is being resolved and its not already loaded by the Read/Write host.
/// </summary>
/// <param name="referringUnit">The unit that is referencing the module.</param>
/// <param name="referencedModule">Module identity for the assembly being referenced.</param>
public virtual void ResolvingModuleReference(IUnit referringUnit, ModuleIdentity referencedModule) {
}
示例3: ModuleStore
internal ModuleStore(
ModuleIdentity moduleIdentitity,
uint internedId,
uint rootNamespaceInternedId
) {
this.ModuleIdentitity = moduleIdentitity;
this.InternedId = internedId;
this.RootNamespaceInternedId = rootNamespaceInternedId;
}
示例4: ModuleReference
/// <summary>
/// Allocates a reference to a .NET module.
/// </summary>
/// <param name="host">Provides a standard abstraction over the applications that host components that provide or consume objects from the metadata model.</param>
/// <param name="moduleIdentity"></param>
public ModuleReference(IMetadataHost host, ModuleIdentity moduleIdentity)
{
this.host = host;
this.moduleIdentity = moduleIdentity;
}
示例5: ProbeModuleReference
public ModuleIdentity ProbeModuleReference(IUnit referringUnit, ModuleIdentity referencedModule) {
throw new NotImplementedException();
}
示例6: LoadModule
/// <summary>
/// The module that matches the given reference, or a dummy module if no matching module can be found.
/// </summary>
public virtual IModule LoadModule(ModuleIdentity moduleIdentity) {
IUnit/*?*/ unit;
lock (GlobalLock.LockingObject) {
this.unitCache.TryGetValue(moduleIdentity, out unit);
}
IModule/*?*/ result;
if (unit != null)
result = unit as IModule;
else {
if (moduleIdentity.Location == "" || moduleIdentity.Location == "unknown://location") {
result = Dummy.Module;
lock (GlobalLock.LockingObject) {
this.unitCache.Add(moduleIdentity, result);
}
} else {
unit = this.LoadUnitFrom(moduleIdentity.Location);
result = unit as IModule;
if (result != null)
lock (GlobalLock.LockingObject) {
this.unitCache.Add(moduleIdentity, result);
this.coreIdentities.Add(result.CoreAssemblySymbolicIdentity);
}
}
}
if (result == null) result = Dummy.Module;
return result;
}
示例7: GetModuleInternedKey
public uint GetModuleInternedKey(ModuleIdentity moduleIdentity) {
return 0;
}
示例8: OpenModule
/// <summary>
/// Method to open the module in the MetadataReader. This method loads the module and returns the object corresponding to the opened module.
/// Also returns the ModuleIDentifier corresponding to the module as the out parameter. Modules are opened as if they are not contained in any assembly.
/// </summary>
/// <param name="binaryDocument">The binary document that needes to be opened as an module.</param>
/// <param name="moduleIdentity">Contains the module identity of the binary document in case it is an module.</param>
/// <returns>Module that is loaded or Dummy.Module in case module could not be loaded.</returns>
public IModule OpenModule(
IBinaryDocument binaryDocument,
out ModuleIdentity/*?*/ moduleIdentity
) {
moduleIdentity = null;
lock (GlobalLock.LockingObject) {
IBinaryDocumentMemoryBlock/*?*/ binaryDocumentMemoryBlock = this.metadataReaderHost.OpenBinaryDocument(binaryDocument);
if (binaryDocumentMemoryBlock == null) {
// Error...
return Dummy.Module;
}
PEFileReader peFileReader = new PEFileReader(this, binaryDocumentMemoryBlock);
if (peFileReader.ReaderState < ReaderState.Metadata) {
// Error...
return Dummy.Module;
}
//^ assert peFileReader.ReaderState >= ReaderState.Metadata;
if (peFileReader.IsAssembly) {
AssemblyIdentity assemblyIdentity = this.GetAssemblyIdentifier(peFileReader);
moduleIdentity = assemblyIdentity;
Assembly/*?*/ lookupAssembly = this.LookupAssembly(null, assemblyIdentity);
if (lookupAssembly != null) {
return lookupAssembly;
}
} else {
moduleIdentity = this.GetModuleIdentifier(peFileReader);
Module/*?*/ lookupModule = this.LookupModule(null, moduleIdentity);
if (lookupModule != null) {
return lookupModule;
}
}
try {
PEFileToObjectModel peFileToObjectModel = new PEFileToObjectModel(this, peFileReader, moduleIdentity, null, this.metadataReaderHost.PointerSize);
this.LoadedModule(peFileToObjectModel.Module);
Assembly/*?*/ assembly = peFileToObjectModel.Module as Assembly;
if (assembly != null) {
this.OpenMemberModules(binaryDocument, assembly);
}
return peFileToObjectModel.Module;
} catch (MetadataReaderException) {
// Error...
}
}
return Dummy.Module;
}
示例9: LoadModule
public IModule LoadModule(ModuleIdentity moduleIdentity) {
return Dummy.Module;
}
示例10: ProbeModuleReference
public ModuleIdentity ProbeModuleReference(IUnit unit, ModuleIdentity referedModuleIdentity) {
return referedModuleIdentity;
}
示例11: GetModuleInternedKey
public uint GetModuleInternedKey(ModuleIdentity moduleIdentity)
{
return m_factory.GetModuleInternedKey(moduleIdentity);
}
示例12: NotImplementedException
ModuleIdentity IMetadataHost.ProbeModuleReference(IUnit referringUnit, ModuleIdentity referencedModule)
{
throw new NotImplementedException();
}
示例13: lock
uint IInternFactory.GetModuleInternedKey(ModuleIdentity moduleIdentity) {
lock (GlobalLock.LockingObject) {
ModuleStore moduleStore = this.GetModuleStore(moduleIdentity);
return moduleStore.InternedId;
}
}
示例14: LookupModule
/// <summary>
/// Does a look up in the loaded modules if the given module identified by moduleIdentifier is loaded. This also gives a chance to MetadataReaderHost to
/// delay load the module if needed.
/// </summary>
/// <param name="referringModule"></param>
/// <param name="moduleIdentity"></param>
/// <returns></returns>
internal Module/*?*/ LookupModule(IModule/*?*/ referringModule, ModuleIdentity moduleIdentity) {
lock (GlobalLock.LockingObject) {
uint internedModuleId = (uint)this.metadataReaderHost.InternFactory.GetModuleInternedKey(moduleIdentity);
Module/*?*/ module = this.InternedIdToModuleMap.Find(internedModuleId);
if (module == null && referringModule != null) {
this.metadataReaderHost.ResolvingModuleReference(referringModule, moduleIdentity);
module = this.InternedIdToModuleMap.Find(internedModuleId);
}
return module;
}
}
示例15: FindModule
/// <summary>
/// Finds the module that matches the given identifier among the already loaded set of modules,
/// or a dummy module if no matching module can be found.
/// </summary>
public IModule FindModule(ModuleIdentity moduleIdentity) {
IUnit/*?*/ unit;
lock (GlobalLock.LockingObject) {
this.unitCache.TryGetValue(moduleIdentity, out unit);
}
IModule/*?*/ result = unit as IModule;
if (result != null)
return result;
return Dummy.Module;
}