Dynamic type scanner for BepInEx with caching
This goes into your BepInEx/plugins
folder
- Create a
ClassDef
- It is recommended that you use a deserializer for this but the builder pattern is supported
- See the builder pattern and YAML representation
- Setup the
ClassDef
withDefinition.Setup
- Your signature must have an ID for this
- You can now access the
Resolved
property- If it is null, your signature yielded no results
- The result should match the signature unless you are using aggressive caching
- You can access all setup types by ID in
Definition.Table
In the configuration file, you can choose a caching mode:
- Disabled: Never check the cache, scan every time
- Slow: ~200 ms for the example on my machine
- Standard: Check that the type still matches the signature
- Fast: ~2 ms
- Aggressive: Just check that the cache isn't null
- Blazingly fast: <0 ms
Please provide feedback with the issues and in the discussions
- Dynamic assembly generation
- Caching modes
- Builder pattern
- Built in typedef scanner
- Built in deserializers
TypeScanner.Types.ClassDef.Create("VRC.Player")
.FromAssembly(AppDomain.CurrentDomain
.GetAssemblies()
.First(x => x.GetName().Name == "Assembly-CSharp")
)
.DerivesFrom<MonoBehaviour>()
.ConstructorCount(2)
.WithMethods(
TypeScanner.Types.MethodDef.Create()
.WithName("OnNetworkReady")
)
.WithProperties(
TypeScanner.Types.PropertyDef.Create()
.WithType<VRC.Core.APIUser>(),
TypeScanner.Types.PropertyDef.Create()
.WithType<VRC.SDKBase.VRCPlayerApi>()
)
.Setup()
// you can now access the `Resolved` property
ID: Player
Assembly: Assembly-CSharp
Derives: UnityEngine.MonoBehaviour,UnityEngine.CoreModule
Counts:
Constructor: 2
Methods:
- Name: OnNetworkReady
Properties:
- Type: VRC.Core.APIUser,VRCCore-Standalone
- Type: VRC.SDKBase.VRCPlayerApi,VRCSDKBase