ExcutorManager.cs 988 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. namespace LJProxy.LJLib.Net.SPI.Server
  6. {
  7. public sealed class ExcutorManager:LJServerBase
  8. {
  9. private Dictionary<string, ExcutorBase> excutors = new Dictionary<string, ExcutorBase>();
  10. private Dictionary<string, string> dynamicHtmlDic = new Dictionary<string, string>();
  11. public void AddMap(string apiName, Type requestType, ExcutorBase excutor, string dynamicHtml = null)
  12. {
  13. excutors[apiName] = excutor;
  14. this.AddMap(apiName, requestType, excutor.Excute);
  15. if (!string.IsNullOrEmpty(dynamicHtml))
  16. {
  17. dynamicHtmlDic[dynamicHtml] = apiName;
  18. }
  19. }
  20. public string getDynamicHtmlApi(string url)
  21. {
  22. if (dynamicHtmlDic.ContainsKey(url))
  23. {
  24. return dynamicHtmlDic[url];
  25. }
  26. return null;
  27. }
  28. }
  29. }