/// <summary> /// Initializes a new instance of <see cref="HookManager"/>. /// </summary> /// <exception cref="ApplicationException"> /// An <see cref="ApplicationException"/> is thrown if another instance of <see cref="HookManager"/> already exists in the current process. /// Instantiating another instance of <see cref="HookManager"/> would result in unexpected behavior and will corrupt <see cref="ThreadACL"/>. /// </exception> public HookManager() { if (_isInstantiated) { throw new ApplicationException("There is already a running HookManager for the current process."); } _isInstantiated = true; _acl = new HookAccessControlList(); _hookProviders = new List <IHookProvider>(); _installedHooks = new List <LocalHook>(); _syncRoot = new object(); }
/// <summary> /// Initializes a new instance of <see cref="HookManager"/>. /// </summary> /// <exception cref="ApplicationException"> /// An <see cref="ApplicationException"/> is thrown if another instance of <see cref="HookManager"/> already exists in the current process. /// Instantiating another instance of <see cref="HookManager"/> would result in unexpected behavior and will corrupt <see cref="ThreadACL"/>. /// </exception> public HookManager() { if (_isInstantiated) throw new ApplicationException("There is already a running HookManager for the current process."); _isInstantiated = true; _acl = new HookAccessControlList(); _hookProviders = new List<IHookProvider>(); _installedHooks = new List<LocalHook>(); _syncRoot = new object(); }