Il2CppFieldInfo.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import {NativeStruct} from "./NativeStruct";
  2. import {il2cppApi} from "../il2cppApi";
  3. import {utils} from "./utils";
  4. import {Il2CppClass} from "./Il2CppClass";
  5. export class Il2CppFieldInfo extends NativeStruct {
  6. getFlags() {
  7. return il2cppApi.il2cpp_field_get_flags(this);
  8. }
  9. /**
  10. * 获取变量参数类型
  11. * @returns {Il2CppType}
  12. */
  13. getType() {
  14. return il2cppApi.il2cpp_field_get_type(this);
  15. }
  16. /**
  17. * 获取 静态常量
  18. * @param value
  19. */
  20. getStaticValue() {
  21. let value = Memory.alloc(Process.pointerSize);
  22. il2cppApi.il2cpp_field_static_get_value(this, value);
  23. return utils.readTypeEnumValue(value, this.getType().getTypeEnum(), this.getFiledClass())
  24. }
  25. /**
  26. * 获取变量class
  27. * @returns {Il2CppClass}
  28. */
  29. getFiledClass() {
  30. let type = this.getType();
  31. return il2cppApi.il2cpp_class_from_type(type);
  32. }
  33. getParent(){
  34. let il2CppClass = il2cppApi.il2cpp_field_get_parent(this);
  35. return new Il2CppClass(il2CppClass);
  36. }
  37. /**
  38. * 获取变量参数的命名
  39. * @returns {string}
  40. */
  41. getFiledName() {
  42. return il2cppApi.il2cpp_field_get_name(this).readCString();
  43. }
  44. /**
  45. * 获取偏移
  46. * @returns {*}
  47. */
  48. getOffset() {
  49. return il2cppApi.il2cpp_field_get_offset(this);
  50. }
  51. }