You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
855 B

  1. #nullable enable
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace IPA.AntiMalware
  8. {
  9. /// <summary>
  10. /// Provides a way to access BSIPA's Anti-Malware engine.
  11. /// </summary>
  12. /// <see cref="Engine"/>
  13. /// <see cref="IAntiMalware"/>
  14. public static class AntiMalwareEngine
  15. {
  16. /// <summary>
  17. /// Gets the current Anti-Malware engine.
  18. /// </summary>
  19. public static IAntiMalware Engine { get; } = InitializeEngine();
  20. private static IAntiMalware InitializeEngine()
  21. {
  22. IAntiMalware? engine = null;
  23. #if !NET35
  24. engine = WindowsCOMAntiMalware.TryInitialize();
  25. #endif
  26. engine ??= new NoopAntiMalware();
  27. return engine;
  28. }
  29. }
  30. }