Ejemplo n.º 1
0
 private ModuleDefinition ReadModule()
 {
     if (_hasSymbols)
     {
         return(ModuleDefinition.ReadModule(
                    _oldName, new ReaderParameters
         {
             ReadSymbols = true,
             SymbolReaderProvider = ProcessorSettings.GetSymbolReaderProvider()
         }));
     }
     return(ModuleDefinition.ReadModule(_oldName));
 }
Ejemplo n.º 2
0
        public AssemblyProcessor(string name, string sn, string[] refFiles)
        {
            var n = name.Substring(0, name.Length - 4);

            if (File.Exists(n + ProcessorSettings.GetExtName()))
            {
                _hasSymbols = true;
            }
            this._oldName  = n + ".bak";
            this._name     = name;
            this._sn       = sn;
            this._refFiles = refFiles;
            Logger.Default.Info(_hasSymbols);
        }
Ejemplo n.º 3
0
        private void WriteAssembly(ModuleDefinition module, string name)
        {
            var args = _hasSymbols ? new WriterParameters
            {
                WriteSymbols         = true,
                SymbolWriterProvider = ProcessorSettings.GetSymbolWriterProvider(),
            }
                           : new WriterParameters();

            if (_sn.IsNullOrEmpty())
            {
                module.Write(name, args);
            }
            else
            {
                using (var s = new FileStream(_sn, FileMode.Open, FileAccess.Read))
                {
                    args.StrongNameKeyPair = new StrongNameKeyPair(s);
                    module.Write(name, args);
                }
            }
        }