コード例 #1
0
        public XmlServiceModule()
        {
            var document = XDocument.Load("Config/NinjectServiceModule.config");

            module = new XmlModule(document.Element("module"), elementHandlers);
            module.OnLoad(kernel);
        }
コード例 #2
0
        /// <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);
            });
        }
コード例 #3
0
ファイル: DiaModule.cs プロジェクト: sdmaclea/SharpDebug
        /// <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));
        }
コード例 #4
0
 /// <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));
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
	    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);
		}
コード例 #8
0
            /// <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();
 }
コード例 #10
0
 public WhenLoadIsCalledForProviderModule()
 {
     this.Kernel.Load("Cases/provider.xml");
     this.module = this.Kernel.GetModules().OfType <XmlModule>().Single();
 }
コード例 #11
0
		public WhenLoadIsCalledForModuleWithBindingMetadata()
		{
			var document = XDocument.Load("Cases/metadata.xml");
			module = new XmlModule(document.Element("module"), elementHandlers);
			module.OnLoad(kernel);
		}
コード例 #12
0
 /// <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));
 }
コード例 #13
0
 /// <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)
 {
 }
コード例 #14
0
 /// <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))
 {
 }
コード例 #15
0
 public WhenLoadIsCalledForBasicModule()
 {
     this.Kernel.Load("Cases/basic.xml");
     this.module = this.Kernel.GetModules().OfType <XmlModule>().Single();
 }
コード例 #16
0
 /// <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));
 }
コード例 #17
0
 /// <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)
 {
 }
コード例 #18
0
 public WhenLoadIsCalledForBasicModule()
 {
     this.Kernel.Load("Cases/basic.xml");
     this.module = this.Kernel.GetModules().OfType<XmlModule>().Single();
 }
コード例 #19
0
ファイル: ToolsEx.cs プロジェクト: szwyt/SzwHighSpeedRack
 public static string ToXml(this object obj)
 {
     return(XmlModule.Serializer(obj));
 }
コード例 #20
0
ファイル: ToolsEx.cs プロジェクト: szwyt/SzwHighSpeedRack
 public static T X2Entity <T>(this string obj)
     where T : class
 {
     return(XmlModule.Deserialize(typeof(T), obj) as T);
 }
コード例 #21
0
		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();
 }
コード例 #23
0
ファイル: Module.cs プロジェクト: southpolenator/WinDbgCs
        /// <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();
 }