/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using System.Collections.Generic; using dnlib.DotNet; using dnSpy.Contracts.Metadata; namespace dnSpy.Contracts.Debugger.DotNet.Metadata { /// /// Loads and creates dynamic modules (they can get extra classses and members at runtime) /// public abstract class DbgDynamicModuleProvider { /// /// Raised when a new class has been loaded in a dynamic assembly /// public abstract event EventHandler? ClassLoaded; /// /// Executes asynchronously on the thread required to load dynamic modules. /// /// Code to execute public abstract void BeginInvoke(Action action); /// /// Gets the dynamic module's metadata or null if none is available /// /// Module /// Module id /// public abstract ModuleDef? GetDynamicMetadata(DbgModule module, out ModuleId moduleId); /// /// Gets all modified types. This method is called on the engine thread (see ) /// /// Module /// public abstract IEnumerable GetModifiedTypes(DbgModule module); /// /// Initializes new classes that haven't gotten a load-class event yet. This method is called on the engine thread (see ) /// /// Module /// Sorted tokens of classes that haven't been loaded but are still present in the metadata public abstract void InitializeNonLoadedClasses(DbgModule module, uint[] nonLoadedTokens); /// /// Called on the engine thread just before and just after all types and members are force loaded /// /// Modules that will be loaded /// true if we're about to load all modules, false if we're done public abstract void LoadEverything(DbgModule[] modules, bool started); } /// /// Class loaded event args /// public readonly struct ClassLoadedEventArgs { /// /// Module /// public DbgModule Module { get; } /// /// Token of loaded class /// public uint LoadedClassToken { get; } /// /// Constructor /// /// Module /// Token of loaded class public ClassLoadedEventArgs(DbgModule module, uint loadedClassToken) { Module = module ?? throw new ArgumentNullException(nameof(module)); LoadedClassToken = loadedClassToken; } } }