本文整理汇总了C#中ModuleDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefinition类的具体用法?C# ModuleDefinition怎么用?C# ModuleDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleDefinition类属于命名空间,在下文中一共展示了ModuleDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetSymbolReader
public ISymbolReader GetSymbolReader(ModuleDefinition module, Stream symbolStream)
{
Mixin.CheckModule (module);
Mixin.CheckStream (symbolStream);
return new PdbReader (Disposable.NotOwned (symbolStream));
}
开发者ID:jbevain,项目名称:cecil,代码行数:7,代码来源:PdbHelper.cs
示例2: GetClrBasicsFor
private static ModuleDefinition GetClrBasicsFor(string file, PEFile pe)
{
var stream = new MemoryStream(File.ReadAllBytes(file));
var reader = new BinaryStreamReader(stream, new byte[1024]);
pe.ReadFrom(reader);
var clrDirectory = pe.OptionalHeader.DataDirectories[(int)DataDirectoryKind.Clr];
var rvaStream = new RvaStream(
stream,
pe.SectionHeaders.Select(
s => new RvaStream.Range
{
PhysicalAddress = s.PointerToRawData,
Size = s.VirtualSize,
VirtualAddress = s.VirtualAddress
})
.ToArray());
rvaStream.Position = clrDirectory.VirtualAddress;
var sectionReader = new BinaryStreamReader(rvaStream, new byte[32]);
var clrmod = new ModuleDefinition();
ClrModuleReader.Read(sectionReader, clrmod);
return clrmod;
}
开发者ID:BGCX261,项目名称:zoompe-git,代码行数:28,代码来源:Program.cs
示例3: GetSchemaFromModuleAsync
public async Task<JSchema> GetSchemaFromModuleAsync(ModuleDefinition module)
{
IEnumerable<TemplateInfo> templates;
if (module.Skins != null)
templates = module.Skins.Values;
else
templates = Enumerable.Empty<TemplateInfo>();
if (module.DefaultTemplate != null)
templates = templates.Union(new[] {module.DefaultTemplate});
var enumerator = templates.GetEnumerator();
if (!enumerator.MoveNext())
return null;
var result = await _schemaProvider.GetSchemaFromTemplateAsync(enumerator.Current).ConfigureAwait(false);
var report = new SchemaComparisionReport();
while (enumerator.MoveNext())
{
var schema = await _schemaProvider.GetSchemaFromTemplateAsync(enumerator.Current).ConfigureAwait(false);
result = _schemaCombiner.Apply(result, schema, report);
}
return result;
}
开发者ID:namics,项目名称:TerrificNet,代码行数:26,代码来源:DefaultModuleSchemaProvider.cs
示例4: PdbWriter
internal PdbWriter(ISymbolWriter writer, ModuleDefinition module, string pdb)
{
m_writer = writer;
m_module = module;
m_documents = new Hashtable ();
m_pdb = pdb;
}
开发者ID:sidecut,项目名称:xaeios,代码行数:7,代码来源:PdbWriter.cs
示例5: ReadModule
public virtual void ReadModule()
{
string symbolsPath;
if (pdbFound)
{
symbolsPath = pdbPath;
}
else
{
symbolsPath = mdbPath;
}
var tempAssembly = $"{AssemblyFilePath}.tmp";
var tempSymbols = $"{symbolsPath}.tmp";
File.Copy(AssemblyFilePath, tempAssembly,true);
File.Copy(symbolsPath, tempSymbols, true);
SymbolStream = File.OpenRead(tempSymbols);
var readerParameters = new ReaderParameters
{
AssemblyResolver = this,
ReadSymbols = true,
SymbolReaderProvider = debugReaderProvider,
SymbolStream = SymbolStream,
};
ModuleDefinition = ModuleDefinition.ReadModule(tempAssembly, readerParameters);
}
开发者ID:Fody,项目名称:Fody,代码行数:26,代码来源:ModuleReader.cs
示例6: TestUseCombinedSkinsSchemaWhenNoDefaultTemplate
public void TestUseCombinedSkinsSchemaWhenNoDefaultTemplate()
{
var templateInfo = new StringTemplateInfo("test", "");
var templateInfo2 = new StringTemplateInfo("test2", "");
var schema1 = new JSchema();
var schema2 = new JSchema();
var templateSchemaProvider = new Mock<ISchemaProvider>();
templateSchemaProvider.Setup(f => f.GetSchemaFromTemplateAsync(templateInfo)).Returns(Task.FromResult(schema1));
templateSchemaProvider.Setup(f => f.GetSchemaFromTemplateAsync(templateInfo2)).Returns(Task.FromResult(schema2));
var combiner = new Mock<SchemaCombiner>();
combiner.Setup(c =>
c.Apply(It.Is<JSchema>(s => s == schema1), It.Is<JSchema>(s => s == schema2), It.IsAny<SchemaComparisionReport>(), It.IsAny<string>()))
.Returns(new JSchema());
var moduleDefintion = new ModuleDefinition("testmod", null, new Dictionary<string, TemplateInfo>
{
{"skin1", templateInfo},
{"skin2", templateInfo2}
});
var underTest = new DefaultModuleSchemaProvider(combiner.Object, templateSchemaProvider.Object);
var result = underTest.GetSchemaFromModuleAsync(moduleDefintion);
Assert.IsNotNull(result);
combiner.Verify();
}
开发者ID:namics,项目名称:TerrificNet,代码行数:30,代码来源:DefaultModuleSchemaProviderTest.cs
示例7: OtherMethod
public void OtherMethod(ModuleDefinition module)
{
var type = module.GetType ("Others");
Assert.IsTrue (type.HasProperties);
var properties = type.Properties;
Assert.AreEqual (1, properties.Count);
var property = properties [0];
Assert.IsNotNull (property);
Assert.AreEqual ("Context", property.Name);
Assert.IsNotNull (property.PropertyType);
Assert.AreEqual ("System.String", property.PropertyType.FullName);
Assert.IsTrue (property.HasOtherMethods);
Assert.AreEqual (2, property.OtherMethods.Count);
var other = property.OtherMethods [0];
Assert.AreEqual ("let_Context", other.Name);
other = property.OtherMethods [1];
Assert.AreEqual ("bet_Context", other.Name);
}
开发者ID:peterwald,项目名称:cecil,代码行数:27,代码来源:PropertyTests.cs
示例8: RefinementToken
public RefinementToken(IToken tok, ModuleDefinition m)
: base(tok)
{
Contract.Requires(tok != null);
Contract.Requires(m != null);
this.InheritingModule = m;
}
开发者ID:Chris-Hawblitzel,项目名称:dafny,代码行数:7,代码来源:RefinementTransformer.cs
示例9: CreateDebugWriter
public static ImageWriter CreateDebugWriter(ModuleDefinition module, MetadataBuilder metadata, Disposable<Stream> stream)
{
var writer = new ImageWriter (module, "PDB V1.0", metadata, stream, metadataOnly: true);
var length = metadata.text_map.GetLength ();
writer.text = new Section { SizeOfRawData = length, VirtualSize = length };
return writer;
}
开发者ID:jbevain,项目名称:cecil,代码行数:7,代码来源:ImageWriter.cs
示例10: ReadModule
public void ReadModule()
{
if (pdbFound)
{
using (var symbolStream = File.OpenRead(pdbPath))
{
var readerParameters = new ReaderParameters
{
AssemblyResolver = this,
ReadSymbols = pdbFound || mdbFound,
SymbolReaderProvider = debugReaderProvider,
SymbolStream = symbolStream
};
ModuleDefinition = ModuleDefinition.ReadModule(AssemblyFilePath, readerParameters);
}
}
else
{
var readerParameters = new ReaderParameters
{
AssemblyResolver = this,
ReadSymbols = pdbFound || mdbFound,
SymbolReaderProvider = debugReaderProvider,
};
ModuleDefinition = ModuleDefinition.ReadModule(AssemblyFilePath, readerParameters);
}
}
开发者ID:CloudMetal,项目名称:Fody,代码行数:28,代码来源:ModuleReader.cs
示例11: ReflectionController
public ReflectionController (ModuleDefinition module)
{
m_reader = new AggressiveReflectionReader (module);
m_writer = new ReflectionWriter (module);
m_helper = new ReflectionHelper (module);
m_importer = new DefaultImporter (module);
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:ReflectionController.cs
示例12: ReplaceTokens
public string ReplaceTokens(string template, ModuleDefinition moduleDefinition, Repository repo, string changestring)
{
var assemblyVersion = moduleDefinition.Assembly.Name.Version;
var branch = repo.Head;
template = template.Replace("%version%", assemblyVersion.ToString());
template = template.Replace("%version1%", assemblyVersion.ToString(1));
template = template.Replace("%version2%", assemblyVersion.ToString(2));
template = template.Replace("%version3%", assemblyVersion.ToString(3));
template = template.Replace("%version4%", assemblyVersion.ToString(4));
template = template.Replace("%now%", now.ToShortDateString());
template = template.Replace("%utcnow%", utcNow.ToShortDateString());
template = template.Replace("%githash%", branch.Tip.Sha);
template = template.Replace("%shorthash%", branch.Tip.Sha.Substring(0, 8));
template = template.Replace("%branch%", branch.FriendlyName);
template = template.Replace("%haschanges%", repo.IsClean() ? "" : changestring);
template = template.Replace("%user%", FormatUserName());
template = template.Replace("%machine%", Environment.MachineName);
template = reEnvironmentToken.Replace(template, FormatEnvironmentVariable);
template = reNow.Replace(template, FormatTime);
template = reUtcNow.Replace(template, FormatUtcTime);
return template.Trim();
}
开发者ID:tenninebt,项目名称:Stamp,代码行数:28,代码来源:FormatStringTokenResolver.cs
示例13: Main
public void Main (ModuleDefinition module)
{
var type = module.GetType ("Program");
var main = type.GetMethod ("Main");
AssertCode (@"
.locals init (System.Int32 i)
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0000: ldc.i4.0
IL_0001: stloc.0
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0002: br IL_0013
.line 8,8:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_0007: ldarg.0
IL_0008: ldloc.0
IL_0009: ldelem.ref
IL_000a: call System.Void Program::Print(System.String)
.line 7,7:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_000f: ldloc.0
IL_0010: ldc.i4.1
IL_0011: add
IL_0012: stloc.0
IL_0013: ldloc.0
IL_0014: ldarg.0
IL_0015: ldlen
IL_0016: conv.i4
IL_0017: blt IL_0007
.line 10,10:0,0 'C:\sources\cecil\symbols\Mono.Cecil.Mdb\Test\Resources\assemblies\hello.cs'
IL_001c: ldc.i4.0
IL_001d: ret
", main);
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:32,代码来源:MdbTests.cs
示例14: PdbWriter
internal PdbWriter (SymWriter writer, ModuleDefinition module, string assembly)
{
m_writer = writer;
m_module = module;
m_documents = new Hashtable ();
m_assembly = assembly;
}
开发者ID:pusp,项目名称:o2platform,代码行数:7,代码来源:PdbWriter.cs
示例15: PortablePdbReader
internal PortablePdbReader(Image image, ModuleDefinition module)
{
this.image = image;
this.module = module;
this.reader = module.reader;
this.debug_reader = new MetadataReader (image, module, this.reader);
}
开发者ID:Unity-Technologies,项目名称:cecil,代码行数:7,代码来源:PortablePdb.cs
示例16: ExportedType
public ExportedType(string @namespace, string name, ModuleDefinition module, IMetadataScope scope)
{
[email protected] = @namespace;
this.name = name;
this.scope = scope;
this.module = module;
}
开发者ID:ttRevan,项目名称:cecil,代码行数:7,代码来源:ExportedType.cs
示例17: GetTypeReference
internal TypeReference GetTypeReference(ModuleDefinition module)
{
var ret = _type as Type;
return ret != null
? module.SafeImport(ret)
: module.SafeImport(_type as TypeReference);
}
开发者ID:mwoelk83,项目名称:Mono.Cecil.Fluent,代码行数:7,代码来源:SystemTypeOrTypeReference.cs
示例18: IdentifyModule
private void IdentifyModule(ModuleDefinition module)
{
if (_allMethods.ContainsKey(module)) return;
_allMethods.Add(module, new Dictionary<ClassDecl, List<Method>>());
foreach (var decl in module.TopLevelDecls)
IdentifyTopLevelDecl(decl);
}
开发者ID:ggrov,项目名称:tacny,代码行数:7,代码来源:RemovableTypeFinder.cs
示例19: GetCustomAttributes
public static Collection<CustomAttribute> GetCustomAttributes (
this ICustomAttributeProvider self,
ModuleDefinition module)
{
return module.HasImage ()
? module.Read (self, (provider, reader) => reader.ReadCustomAttributes (provider))
: new Collection<CustomAttribute> ();
}
开发者ID:fugaku,项目名称:scriptsharp,代码行数:8,代码来源:ICustomAttributeProvider.cs
示例20: UpdateModelForModuleAsync
public Task UpdateModelForModuleAsync(ModuleDefinition moduleDefinition, string dataId, object content)
{
var filePath = GetPath(moduleDefinition, dataId != null ? PathInfo.Create(dataId) : DefaultFilename);
if (!_fileSystem.DirectoryExists(_fileSystem.Path.GetDirectoryName(filePath)))
_fileSystem.CreateDirectory(_fileSystem.Path.GetDirectoryName(filePath));
return Update(content, filePath);
}
开发者ID:namics,项目名称:TerrificNet,代码行数:8,代码来源:JsonModelProvider.cs
注:本文中的ModuleDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论