public XmlServiceModule() { var document = XDocument.Load("Config/NinjectServiceModule.config"); module = new XmlModule(document.Element("module"), elementHandlers); module.OnLoad(kernel); }
/// <summary> /// Initializes a new instance of the <see cref="PdbModule"/> class. /// </summary> /// <param name="module">The XML module description.</param> /// <param name="pdbFile">Already opened PDB file.</param> public PdbModule(XmlModule module, PdbFile pdbFile) { PdbFile = pdbFile; Name = !string.IsNullOrEmpty(module.Name) ? module.Name : Path.GetFileNameWithoutExtension(module.SymbolsPath).ToLower(); Namespace = module.Namespace; globalScopeCache = SimpleCache.CreateStruct(() => new PdbGlobalScope(this)); builtinSymbolsCache = new DictionaryCache <TypeIndex, PdbSymbol>(CreateBuiltinSymbol); allSymbolsCache = new ArrayCache <PdbSymbol>(PdbFile.TpiStream.TypeRecordCount, CreateSymbol); definedSymbolsCache = new ArrayCache <PdbSymbol>(PdbFile.TpiStream.TypeRecordCount, true, GetDefinedSymbol); constantsCache = SimpleCache.CreateStruct(() => { Dictionary <string, ConstantSymbol> constants = new Dictionary <string, ConstantSymbol>(); foreach (SymbolRecordKind kind in ConstantSymbol.Kinds) { foreach (ConstantSymbol c in PdbFile.PdbSymbolStream[kind].OfType <ConstantSymbol>()) { if (!constants.ContainsKey(c.Name)) { constants.Add(c.Name, c); } } } return((IReadOnlyDictionary <string, ConstantSymbol>)constants); }); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="module">The XML module description.</param> public static Module Open(XmlModule module) { IDiaDataSource dia = DiaLoader.CreateDiaSource(); IDiaSession session; string moduleName = !string.IsNullOrEmpty(module.Name) ? module.Name : Path.GetFileNameWithoutExtension(module.SymbolsPath).ToLower(); module.Name = moduleName; dia.loadDataFromPdb(module.SymbolsPath); dia.openSession(out session); return(new DiaModule(module.Name, module.Namespace, dia, session)); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="xmlModule">The XML module description.</param> public virtual Module Open(XmlModule xmlModule) { foreach (var module in Process.Modules) { if (module.SymbolFileName == xmlModule.SymbolsPath || module.MappedImageName == xmlModule.SymbolsPath) { return(new EngineSymbolProviderModule(module, xmlModule)); } } throw new ArgumentException("Couldn't find XML module in current process modules list.", nameof(xmlModule)); }
/// <summary> /// Initializes a new instance of the <see cref="EngineSymbolProviderModule" /> class. /// </summary> /// <param name="module">The engine module.</param> /// <param name="xmlModule">The XML module description.</param> /// <param name="symbolProvider">The engine symbol provider.</param> public EngineSymbolProviderModule(CsDebugScript.Module module, XmlModule xmlModule, ISymbolProvider symbolProvider) { if (string.IsNullOrEmpty(xmlModule.Name)) { xmlModule.Name = module.Name; } Name = xmlModule.Name; Namespace = xmlModule.Namespace; EngineModule = module; EngineModuleProvider = symbolProvider.GetSymbolProviderModule(module); symbolsById = new DictionaryCache <uint, Symbol>(CreateSymbol); symbolsByName = new DictionaryCache <string, Symbol>(FindSymbol); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="xmlModule">The XML module description.</param> public SharpDebug.CodeGen.SymbolProviders.Module Open(XmlModule xmlModule) { Module module = new Module(default(Process), 0) { Name = xmlModule.Name, SymbolFileName = xmlModule.SymbolsPath, MappedImageName = xmlModule.SymbolsPath, ImageName = xmlModule.SymbolsPath, }; var result = new EngineSymbolProviderModule(module, xmlModule, symbolProvider); DwarfSymbolProviderModule provider = (DwarfSymbolProviderModule)result.EngineModuleProvider; module.PointerSize = provider.Is64bit ? 8U : 4U; return(result); }
public void Handle(XmlModule module, XElement element) { XAttribute serviceAttribute = element.RequiredAttribute("service"); Type service = GetTypeFromAttributeValue(serviceAttribute); var binding = new Binding(service); var builder = new BindingBuilder<object>(binding, _kernel); module.AddBinding(binding); if (!HandleTarget(element, builder)) throw new ConfigurationErrorsException("The 'bind' element does not define either a 'to' or 'toProvider' attribute."); ReadName(element, builder); ReadMetadata(element, builder); ReadScope(element, builder); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="xmlModule">The XML module description.</param> public override CodeGen.SymbolProviders.Module Open(XmlModule xmlModule) { try { if (UsePdbReaderWhenPossible && xmlModule?.SymbolsPath != null && Path.GetExtension(xmlModule.SymbolsPath).ToLower() == ".pdb") { PdbSymbolProvider.PdbModule pdbModule = new PdbSymbolProvider.PdbModule(xmlModule); lock (pdbModules) { pdbModules.Add(pdbModule); } return(pdbModule); } } catch { } return(base.Open(xmlModule)); }
public WhenLoadIsCalledForModuleWithBindingMetadata() { this.Kernel.Load("Cases/metadata.xml"); this.module = this.Kernel.GetModules().OfType <XmlModule>().Single(); }
public WhenLoadIsCalledForProviderModule() { this.Kernel.Load("Cases/provider.xml"); this.module = this.Kernel.GetModules().OfType <XmlModule>().Single(); }
public WhenLoadIsCalledForModuleWithBindingMetadata() { var document = XDocument.Load("Cases/metadata.xml"); module = new XmlModule(document.Element("module"), elementHandlers); module.OnLoad(kernel); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="module">The XML module description.</param> public Module Open(XmlModule module) { return(DiaModule.Open(module)); }
/// <summary> /// Initializes a new instance of the <see cref="EngineSymbolProviderModule"/> class. /// </summary> /// <param name="module">The engine module.</param> /// <param name="xmlModule">The XML module description.</param> public EngineSymbolProviderModule(CsDebugScript.Module module, XmlModule xmlModule) : this(module, xmlModule, Context.SymbolProvider) { }
/// <summary> /// Initializes a new instance of the <see cref="PdbModule"/> class. /// </summary> /// <param name="module">The XML module description.</param> public PdbModule(XmlModule module) : this(module, new PdbFile(module.SymbolsPath)) { }
public WhenLoadIsCalledForBasicModule() { this.Kernel.Load("Cases/basic.xml"); this.module = this.Kernel.GetModules().OfType <XmlModule>().Single(); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="module">The XML module description.</param> public Module Open(XmlModule module) { return(new PdbModule(module)); }
/// <summary> /// Initializes a new instance of the <see cref="EngineSymbolProviderModule"/> class. /// </summary> /// <param name="module">The engine module.</param> /// <param name="xmlModule">The XML module description.</param> public EngineSymbolProviderModule(SharpDebug.Module module, XmlModule xmlModule) : this(module, xmlModule, Context.SymbolProvider) { }
public WhenLoadIsCalledForBasicModule() { this.Kernel.Load("Cases/basic.xml"); this.module = this.Kernel.GetModules().OfType<XmlModule>().Single(); }
public static string ToXml(this object obj) { return(XmlModule.Serializer(obj)); }
public static T X2Entity <T>(this string obj) where T : class { return(XmlModule.Deserialize(typeof(T), obj) as T); }
public WhenLoadIsCalledForProviderModule() { var document = XDocument.Load("Cases/provider.xml"); module = new XmlModule(document.Element("module"), elementHandlers); module.OnLoad(kernel); }
public WhenLoadIsCalledForProviderModule() { this.Kernel.Load("Cases/provider.xml"); this.module = this.Kernel.GetModules().OfType<XmlModule>().Single(); }
/// <summary> /// Opens the module for the specified XML module description. /// </summary> /// <param name="module">The XML module description.</param> public static Module Open(XmlModule module) { IDiaDataSource dia = new DiaSource(); IDiaSession session; string moduleName = !string.IsNullOrEmpty(module.Name) ? module.Name : Path.GetFileNameWithoutExtension(module.PdbPath).ToLower(); module.Name = moduleName; dia.loadDataFromPdb(module.PdbPath); dia.openSession(out session); return new Module(module.Name, module.Namespace, dia, session); }
public WhenLoadIsCalledForModuleWithBindingMetadata() { this.Kernel.Load("Cases/metadata.xml"); this.module = this.Kernel.GetModules().OfType<XmlModule>().Single(); }