FilterManager.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using CefSharp;
  2. using System.Collections.Generic;
  3. namespace UAS_Web.tool
  4. {
  5. class FilterManager
  6. {
  7. public static Dictionary<string, IResponseFilter> dataList = new Dictionary<string, IResponseFilter>();
  8. public static IResponseFilter CreateFilter(string guid)
  9. {
  10. try
  11. {
  12. lock (dataList)
  13. {
  14. var filter = new MessageFilter();
  15. dataList.Add(guid, filter);
  16. return filter;
  17. }
  18. }
  19. catch (System.Exception e)
  20. {
  21. System.Console.WriteLine("插入报错" + e.Message.ToString());
  22. }
  23. return null;
  24. }
  25. public static IResponseFilter GetFileter(string guid)
  26. {
  27. try
  28. {
  29. lock (dataList)
  30. {
  31. return dataList[guid];
  32. }
  33. }
  34. catch (System.Exception e)
  35. {
  36. System.Console.WriteLine("读取报错" + e.Message.ToString());
  37. }
  38. return null;
  39. }
  40. }
  41. }