StaticRpcMethodProvider.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Threading.Tasks;
  6. namespace JsonRPC4.Router
  7. {
  8. internal class StaticRpcMethodProvider : IRpcMethodProvider
  9. {
  10. // Token: 0x1700003E RID: 62
  11. // (get) Token: 0x060000B0 RID: 176 RVA: 0x00003488 File Offset: 0x00001688
  12. private List<MethodInfo> baseMethods { get; }
  13. // Token: 0x1700003F RID: 63
  14. // (get) Token: 0x060000B1 RID: 177 RVA: 0x00003490 File Offset: 0x00001690
  15. private Dictionary<RpcPath, List<MethodInfo>> methods { get; }
  16. // Token: 0x060000B2 RID: 178 RVA: 0x00003498 File Offset: 0x00001698
  17. public StaticRpcMethodProvider(List<MethodInfo> baseMethods, Dictionary<RpcPath, List<MethodInfo>> methods)
  18. {
  19. this.baseMethods = baseMethods;
  20. this.methods = methods;
  21. }
  22. // Token: 0x060000B3 RID: 179 RVA: 0x000034B0 File Offset: 0x000016B0
  23. public bool TryGetByPath(RpcPath path, out IReadOnlyList<MethodInfo> methods)
  24. {
  25. if (path == null)
  26. {
  27. methods = this.baseMethods;
  28. return true;
  29. }
  30. List<MethodInfo> list;
  31. if (this.methods.TryGetValue(path, out list))
  32. {
  33. methods = list;
  34. return true;
  35. }
  36. methods = null;
  37. return false;
  38. }
  39. }
  40. }