/// <summary> /// /// </summary> /// <param name="isTestRun"></param> /// <returns>This tells the service provider not to start the protective services since this is a test run.</returns> public bool Start(bool isTestRun) { try { var assembly = Assembly.GetExecutingAssembly(); var baseDirectory = Path.GetDirectoryName(assembly.Location); var dllDirectory = Path.Combine(baseDirectory, Environment.Is64BitProcess ? "x64" : "x86"); SetDllDirectory(dllDirectory); m_logger = LoggerUtil.GetAppWideLogger(); return(m_provider.Start(isTestRun)); } catch (Exception e) { // Critical failure. try { EventLog.CreateEventSource("FilterServiceProvider", "Application"); EventLog.WriteEntry("FilterServiceProvider", $"Exception occurred before logger was bootstrapped: {e.ToString()}"); } catch (Exception e2) { File.AppendAllText(@"C:\FilterServiceProvider.FatalCrashLog.log", $"Fatal crash.\r\n{e.ToString()}\r\n{e2.ToString()}"); } //LoggerUtil.RecursivelyLogException(m_logger, e); return(false); } }
public bool Start() { System.AppDomain.CurrentDomain.FirstChanceException += (object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e) => { Console.WriteLine("First Chance exception: {0}", e.Exception); }; commonProvider.OnStopFiltering += (sender, e) => { MacProxyEnforcement.SetProxy(null, 0, 0); }; Console.WriteLine("Starting common filter provider."); return(commonProvider.Start()); }