当前位置: 首页>>代码示例>>C#>>正文


C# ModuleDefMD.LoadPdb方法代码示例

本文整理汇总了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
        }
开发者ID:cvexva,项目名称:dnSpy,代码行数:18,代码来源:LoadedAssembly.cs

示例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);
        }
开发者ID:cybercircuits,项目名称:ConfuserEx,代码行数:74,代码来源:ObfAttrMarker.cs

示例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);
        }
开发者ID:RSchwoerer,项目名称:ConfuserEx,代码行数:60,代码来源:ObfAttrMarker.cs


注:本文中的dnlib.DotNet.ModuleDefMD.LoadPdb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。