本文整理汇总了C#中dnlib.DotNet.ModuleDefMD.LoadPdb方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefMD.LoadPdb方法的具体用法?C# ModuleDefMD.LoadPdb怎么用?C# ModuleDefMD.LoadPdb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnlib.DotNet.ModuleDefMD
的用法示例。
在下文中一共展示了ModuleDefMD.LoadPdb方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSymbols
private void LoadSymbols(ModuleDefMD module)
{
if (module == null || string.IsNullOrWhiteSpace(fileName))
return;
// Happens if a module has been removed but then the exact same instance
// was re-added.
if (module.PdbState != null)
return;
// search for pdb in same directory as dll
string pdbName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb");
if (File.Exists(pdbName)) {
module.LoadPdb(pdbName);
return;
}
// TODO: use symbol cache, get symbols from microsoft
}
示例2: MarkModule
void MarkModule(ModuleDefMD module, bool isMain)
{
var settingAttrs = new List<ObfuscationAttributeInfo>();
string snKeyPath = null, snKeyPass = null;
Dictionary<Regex, List<ObfuscationAttributeInfo>> namespaceAttrs;
if (!crossModuleAttrs.TryGetValue(module.Name, out namespaceAttrs)) {
namespaceAttrs = new Dictionary<Regex, List<ObfuscationAttributeInfo>>();
}
foreach (var attr in ReadObfuscationAttributes(module.Assembly)) {
if (attr.FeatureName.Equals("generate debug symbol", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'generate debug symbol'.");
project.Debug = bool.Parse(attr.FeatureValue);
}
if (project.Debug) {
module.LoadPdb();
}
if (attr.FeatureName.Equals("random seed", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'random seed'.");
project.Seed = attr.FeatureValue;
}
else if (attr.FeatureName.Equals("strong name key", StringComparison.OrdinalIgnoreCase)) {
snKeyPath = Path.Combine(project.BaseDirectory, attr.FeatureValue);
}
else if (attr.FeatureName.Equals("strong name key password", StringComparison.OrdinalIgnoreCase)) {
snKeyPass = attr.FeatureValue;
}
else if (attr.FeatureName.Equals("packer", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'packer'.");
new ObfAttrParser(packers).ParsePackerString(attr.FeatureValue, out packer, out packerParams);
}
else if (attr.FeatureName.Equals("external module", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can add external modules.");
var rawModule = new ProjectModule { Path = attr.FeatureValue }.LoadRaw(project.BaseDirectory);
extModules.Add(rawModule);
}
else if (attr.FeatureName == "") {
settingAttrs.Add(attr);
}
else {
var match = NSInModulePattern.Match(attr.FeatureName);
if (match.Success) {
if (!isMain)
throw new ArgumentException("Only main module can set cross module obfuscation.");
var ns = TranslateNamespaceRegex(match.Groups[1].Value);
string targetModule = match.Groups[2].Value;
var x = attr;
x.FeatureName = "";
Dictionary<Regex, List<ObfuscationAttributeInfo>> targetModuleAttrs;
if (!crossModuleAttrs.TryGetValue(targetModule, out targetModuleAttrs)) {
targetModuleAttrs = new Dictionary<Regex, List<ObfuscationAttributeInfo>>();
crossModuleAttrs[targetModule] = targetModuleAttrs;
}
targetModuleAttrs.AddListEntry(ns, x);
}
else {
match = NSPattern.Match(attr.FeatureName);
if (match.Success) {
var ns = TranslateNamespaceRegex(match.Groups[1].Value);
var x = attr;
x.FeatureName = "";
namespaceAttrs.AddListEntry(ns, x);
}
}
}
}
ProcessModule(module, snKeyPath, snKeyPass, settingAttrs, namespaceAttrs);
}
示例3: MarkModule
void MarkModule(ProjectModule projModule, ModuleDefMD module, Rules rules, bool isMain)
{
string snKeyPath = projModule.SNKeyPath, snKeyPass = projModule.SNKeyPassword;
var stack = new ProtectionSettingsStack(context, protections);
var layer = new List<ProtectionSettingsInfo>();
// Add rules
foreach (var rule in rules)
layer.Add(ToInfo(rule.Key, rule.Value));
// Add obfuscation attributes
foreach (var attr in ReadObfuscationAttributes(module.Assembly)) {
if (string.IsNullOrEmpty(attr.FeatureName)) {
ProtectionSettingsInfo info;
if (ToInfo(attr, out info))
layer.Add(info);
}
else if (attr.FeatureName.Equals("generate debug symbol", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'generate debug symbol'.");
project.Debug = bool.Parse(attr.FeatureValue);
}
else if (attr.FeatureName.Equals("random seed", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'random seed'.");
project.Seed = attr.FeatureValue;
}
else if (attr.FeatureName.Equals("strong name key", StringComparison.OrdinalIgnoreCase)) {
snKeyPath = Path.Combine(project.BaseDirectory, attr.FeatureValue);
}
else if (attr.FeatureName.Equals("strong name key password", StringComparison.OrdinalIgnoreCase)) {
snKeyPass = attr.FeatureValue;
}
else if (attr.FeatureName.Equals("packer", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can set 'packer'.");
new ObfAttrParser(packers).ParsePackerString(attr.FeatureValue, out packer, out packerParams);
}
else if (attr.FeatureName.Equals("external module", StringComparison.OrdinalIgnoreCase)) {
if (!isMain)
throw new ArgumentException("Only main module can add external modules.");
var rawModule = new ProjectModule { Path = attr.FeatureValue }.LoadRaw(project.BaseDirectory);
extModules.Add(rawModule);
}
else {
AddRule(attr, layer);
}
}
if (project.Debug) {
module.LoadPdb();
}
snKeyPath = snKeyPath == null ? null : Path.Combine(project.BaseDirectory, snKeyPath);
var snKey = LoadSNKey(context, snKeyPath, snKeyPass);
context.Annotations.Set(module, SNKey, snKey);
using (stack.Apply(module, layer))
ProcessModule(module, stack);
}