/// <summary> /// Initializes a new instance of <see cref="LogBus"/>. /// </summary> /// <param name="serverReporter"> /// The <see cref="IServerReporter"/> to use for marshalling log messages to the host process. /// </param> public LogBus(IServerReporter serverReporter) { _serverReporter = serverReporter; _level = serverReporter.GetRequiredLogLevel(); _logType = LogType.Other; _syncRoot = new object(); #if !SYNCLOG _queue = new Queue <LogMessage>(); _timer = new Timer(_FlushInterval); _timer.Elapsed += SendMessages; #endif }
/// <summary> /// Initializes the <see cref="EngineCore"/>. /// </summary> /// <param name="processSynchronizer"> /// The <see cref="IProcessSynchronizer"/> to use for communication with the host. /// </param> public static void Initialize(IProcessSynchronizer processSynchronizer) { lock (_syncRoot) { if (_initialized) { return; } // Initialize variables. _currentProcessId = RemoteHooking.GetCurrentProcessId(); _serverReporter = processSynchronizer; _logBus = new LogBus(processSynchronizer); #if !SYNCLOG _logBus.Enabled = true; #endif _engine = VirtualizationEngine.InitializeEngine(processSynchronizer); // Attach ProcessExit event handler. AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; // Mark instance as initialized. _initialized = true; Log.Message("Successfully initialized core components."); } }
/// <summary> /// Initializes a new instance of <see cref="LogBus"/>. /// </summary> /// <param name="serverReporter"> /// The <see cref="IServerReporter"/> to use for marshalling log messages to the host process. /// </param> public LogBus(IServerReporter serverReporter) { _serverReporter = serverReporter; _level = serverReporter.GetRequiredLogLevel(); _logType = LogType.Other; _syncRoot = new object(); #if !SYNCLOG _queue = new Queue<LogMessage>(); _timer = new Timer(_FlushInterval); _timer.Elapsed += SendMessages; #endif }
/// <summary> /// Initializes the <see cref="EngineCore"/>. /// </summary> /// <param name="processSynchronizer"> /// The <see cref="IProcessSynchronizer"/> to use for communication with the host. /// </param> public static void Initialize(IProcessSynchronizer processSynchronizer) { lock (_syncRoot) { if (_initialized) return; // Initialize variables. _currentProcessId = RemoteHooking.GetCurrentProcessId(); _serverReporter = processSynchronizer; _logBus = new LogBus(processSynchronizer); #if !SYNCLOG _logBus.Enabled = true; #endif _engine = VirtualizationEngine.InitializeEngine(processSynchronizer); // Attach ProcessExit event handler. AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; // Mark instance as initialized. _initialized = true; Log.Message("Successfully initialized core components."); } }