KnownEndpoints.cs 884 B

1234567891011121314151617181920212223242526272829
  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 GoogleTranslate = new GoogleTranslateEndpoint();
  11. public static readonly KnownEndpoint BaiduTranslate = new BaiduTranslateEndpoint();
  12. public static KnownEndpoint FindEndpoint( string identifier )
  13. {
  14. if( string.IsNullOrEmpty( identifier ) ) return null;
  15. switch( identifier )
  16. {
  17. case KnownEndpointNames.GoogleTranslate:
  18. return GoogleTranslate;
  19. case KnownEndpointNames.BaiduTranslate:
  20. return BaiduTranslate;
  21. default:
  22. return new DefaultEndpoint( identifier );
  23. }
  24. }
  25. }
  26. }