HtexExtensions.cs 909 B

1234567891011121314151617181920212223
  1. using HTEXLib.Translator;
  2. using Microsoft.Extensions.DependencyInjection;
  3. using Microsoft.Extensions.DependencyInjection.Extensions;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. namespace HTEXLib.Translator
  8. {
  9. public static class HtexExtensions
  10. {
  11. public static IServiceCollection AddHtexTranslator(this IServiceCollection services,string configPath)
  12. {
  13. if (services == null) throw new ArgumentNullException(nameof(services));
  14. services.TryAddScoped<PPTX2HTEXTranslator>();
  15. services.TryAddScoped<DOXC2HTMLTranslator>();
  16. //services.TryAddScoped<HTML2ITEMTranslator>();
  17. // services.TryAddSingleton<HTML2ITEMV2Translator>(new HTML2ITEMV2Translator(configPath));
  18. services.TryAddSingleton<HTML2ITEMV3Translator>(new HTML2ITEMV3Translator(configPath));
  19. return services;
  20. }
  21. }
  22. }