KnownEndpoints.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using XUnity.AutoTranslator.Plugin.Core.Constants;
  6. namespace XUnity.AutoTranslator.Plugin.Core.Web
  7. {
  8. public static class KnownEndpoints
  9. {
  10. public static readonly KnownEndpoint GoogleTranslateLegacy = new GoogleTranslateLegacyEndpoint();
  11. public static readonly KnownEndpoint GoogleTranslateHack = new GoogleTranslateHackEndpoint();
  12. public static readonly KnownEndpoint BaiduTranslate = new BaiduTranslateEndpoint();
  13. public static readonly KnownEndpoint YandexTranslate = new YandexTranslateEndpoint();
  14. public static readonly KnownEndpoint WatsonTranslate = new WatsonTranslateEndpoint();
  15. public static readonly KnownEndpoint ExciteTranslate = new ExciteTranslateEndpoint();
  16. public static KnownEndpoint FindEndpoint( string identifier )
  17. {
  18. if( string.IsNullOrEmpty( identifier ) ) return null;
  19. switch( identifier )
  20. {
  21. case KnownEndpointNames.GoogleTranslateLegacy:
  22. return GoogleTranslateLegacy;
  23. case KnownEndpointNames.GoogleTranslateHack:
  24. return GoogleTranslateHack;
  25. case KnownEndpointNames.BaiduTranslate:
  26. return BaiduTranslate;
  27. case KnownEndpointNames.YandexTranslate:
  28. return YandexTranslate;
  29. case KnownEndpointNames.WatsonTranslate:
  30. return WatsonTranslate;
  31. case KnownEndpointNames.ExciteTranslate:
  32. return ExciteTranslate;
  33. default:
  34. return new DefaultEndpoint( identifier );
  35. }
  36. }
  37. }
  38. }