From a46d54186dd232d678d6c58ebce317550cc58e7f Mon Sep 17 00:00:00 2001 From: praydog Date: Sun, 17 Mar 2024 20:48:40 -0700 Subject: [PATCH] .NET: Remove C# wrappers --- csharp-api/Wrappers/ApiWrapper.cs | 57 ------ csharp-api/test/Test/ApiWrapper.cs | 51 ----- csharp-api/test/Test/ManagedObjectWrapper.cs | 58 ------ csharp-api/test/Test/MethodWrapper.cs | 71 ------- csharp-api/test/Test/TDBWrapper.cs | 82 -------- csharp-api/test/Test/TypeDefinitionWrapper.cs | 193 ------------------ 6 files changed, 512 deletions(-) delete mode 100644 csharp-api/Wrappers/ApiWrapper.cs delete mode 100644 csharp-api/test/Test/ApiWrapper.cs delete mode 100644 csharp-api/test/Test/ManagedObjectWrapper.cs delete mode 100644 csharp-api/test/Test/MethodWrapper.cs delete mode 100644 csharp-api/test/Test/TDBWrapper.cs delete mode 100644 csharp-api/test/Test/TypeDefinitionWrapper.cs diff --git a/csharp-api/Wrappers/ApiWrapper.cs b/csharp-api/Wrappers/ApiWrapper.cs deleted file mode 100644 index 70e80ffa3..000000000 --- a/csharp-api/Wrappers/ApiWrapper.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using reframework; - -public class APIWrapper -{ - private readonly reframework.API _original; - - public APIWrapper(API original) - { - _original = original; - } - - public API.REFrameworkPluginInitializeParam* Param() - { - return _original.param(); - } - - public API.REFrameworkSDKData* Sdk() - { - return _original.sdk(); - } - - public API.TDB Tdb() - { - return _original.tdb(); - } - - public API.ResourceManager ResourceManager() - { - return _original.resource_manager(); - } - - public API.REFramework_ Reframework() - { - return _original.reframework(); - } - - public API.VMContext GetVmContext() - { - return _original.get_vm_context(); - } - - public ManagedObject Typeof(String name) - { - return _original.Invoke("typeof", name); - } - - public ManagedObject GetManagedSingleton(String name) - { - return _original.get_managed_singleton(name); - } - - public Void* GetNativeSingleton(String name) - { - return _original.get_native_singleton(name); - } -} diff --git a/csharp-api/test/Test/ApiWrapper.cs b/csharp-api/test/Test/ApiWrapper.cs deleted file mode 100644 index 94bbcb78b..000000000 --- a/csharp-api/test/Test/ApiWrapper.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using reframework; - -public class APIWrapper -{ - private readonly reframework.API _original; - - public APIWrapper(API original) - { - _original = original; - } - - public TDBWrapper GetTDB() - { - return new TDBWrapper(_original.tdb()); - } - - public API.ResourceManager GetResourceManager() - { - return _original.resource_manager(); - } - - public API.REFramework_ Get() - { - return _original.reframework(); - } - - public API.VMContext GetVMContext() - { - return _original.get_vm_context(); - } - - public API.ManagedObject TypeOf(String name) - { - return (API.ManagedObject)_original.GetType().InvokeMember("typeof", System.Reflection.BindingFlags.Public, null, _original, new object[]{ _original, name }); - } - - public API.ManagedObject GetManagedSingleton(String name) - { - return _original.get_managed_singleton(name); - } - - public List GetManagedSingletons() { - return _original.get_managed_singletons(); - } - - public System.UIntPtr GetNativeSingleton(String name) - { - return (System.UIntPtr)_original.get_native_singleton(name); - } -} diff --git a/csharp-api/test/Test/ManagedObjectWrapper.cs b/csharp-api/test/Test/ManagedObjectWrapper.cs deleted file mode 100644 index 1b4c5facf..000000000 --- a/csharp-api/test/Test/ManagedObjectWrapper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using static reframework.API; -public class ManagedObjectWrapper { - private readonly ManagedObject _original; - - public ManagedObjectWrapper(ManagedObject original) { - _original = original; - _original.add_ref(); - } - - ~ManagedObjectWrapper() { - _original.release(); - } - - public void AddRef() { - _original.add_ref(); - } - - public void Release() { - _original.release(); - } - - public TypeDefinitionWrapper GetTypeDefinition() { - return new TypeDefinitionWrapper(_original.get_type_definition()); - } - - public Boolean IsManagedObject() { - return _original.is_managed_object(); - } - - public UInt32 GetRefCount() { - return _original.get_ref_count(); - } - - public UInt32 GetVmObjType() { - return _original.get_vm_obj_type(); - } - - public TypeInfo GetTypeInfo() { - return _original.get_type_info(); - } - - /*public Void* GetReflectionProperties() { - return _original.get_reflection_properties(); - }*/ - - /*public ReflectionProperty GetReflectionPropertyDescriptor(basic_string_view> name) { - return _original.get_reflection_property_descriptor(name); - } - - public ReflectionMethod GetReflectionMethodDescriptor(basic_string_view> name) { - return _original.get_reflection_method_descriptor(name); - }*/ - - public reframework.DotNetInvokeRet Invoke(String methodName, object[] args) { - return _original.invoke(methodName, args); - } -} diff --git a/csharp-api/test/Test/MethodWrapper.cs b/csharp-api/test/Test/MethodWrapper.cs deleted file mode 100644 index 65f0e8018..000000000 --- a/csharp-api/test/Test/MethodWrapper.cs +++ /dev/null @@ -1,71 +0,0 @@ -using reframework; -using System; -using static reframework.API; -public class MethodWrapper { - private readonly Method _original; - - public MethodWrapper(Method original) { - _original = original; - } - - public DotNetInvokeRet Invoke(Object obj, Object[] args) { - return _original.invoke(obj, args); - } - - /*public Void* GetFunctionRaw() { - return _original.get_function_raw(); - }*/ - - public string GetName() { - return _original.get_name(); - } - - public TypeDefinitionWrapper GetDeclaringType() { - return new TypeDefinitionWrapper(_original.get_declaring_type()); - } - - public TypeDefinitionWrapper GetReturnType() { - return new TypeDefinitionWrapper(_original.get_return_type()); - } - - public UInt32 GetNumParams() { - return _original.get_num_params(); - } - - public List GetParameters() { - return _original.get_params(); - } - - public UInt32 GetIndex() { - return _original.get_index(); - } - - public Int32 GetVirtualIndex() { - return _original.get_virtual_index(); - } - - public Boolean IsStatic() { - return _original.is_static(); - } - - public UInt16 GetFlags() { - return _original.get_flags(); - } - - public UInt16 GetImplFlags() { - return _original.get_impl_flags(); - } - - public UInt32 GetInvokeID() { - return _original.get_invoke_id(); - } - - // hmm... - /*public UInt32 AddHook(pre_fn, post_fn, Boolean ignore_jmp) { - return _original.add_hook(pre_fn, post_fn, ignore_jmp); - }*/ - - public void RemoveHook(UInt32 hook_id) { - _original.remove_hook(hook_id); - } -} diff --git a/csharp-api/test/Test/TDBWrapper.cs b/csharp-api/test/Test/TDBWrapper.cs deleted file mode 100644 index 2a11a4a96..000000000 --- a/csharp-api/test/Test/TDBWrapper.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; - -using static reframework.API; -public class TDBWrapper { - private readonly TDB _original; - - public TDBWrapper(TDB original) { - _original = original; - } - - public UInt32 GetNumTypes() { - return _original.get_num_types(); - } - - public UInt32 GetNumMethods() { - return _original.get_num_methods(); - } - - public UInt32 GetNumFields() { - return _original.get_num_fields(); - } - - public UInt32 GetNumProperties() { - return _original.get_num_properties(); - } - - public UInt32 GetStringsSize() { - return _original.get_strings_size(); - } - - public UInt32 GetRawDataSize() { - return _original.get_raw_data_size(); - } - - /*public SByte* GetStringDatabase() { - return _original.get_string_database(); - } - - public Byte* GetRawDatabase() { - return _original.get_raw_database(); - }*/ - - public Span GetRawData() { - return _original.get_raw_data(); - } - - public String GetString(UInt32 index) { - return _original.get_string(index); - } - - public TypeDefinitionWrapper GetType(UInt32 index) { - return new TypeDefinitionWrapper(_original.get_type(index)); - } - - public TypeDefinitionWrapper FindType(String name) { - return new TypeDefinitionWrapper(_original.find_type(name)); - } - - public TypeDefinitionWrapper FindTypeByFqn(UInt32 fqn) { - return new TypeDefinitionWrapper(_original.find_type_by_fqn(fqn)); - } - - public Method GetMethod(UInt32 index) { - return _original.get_method(index); - } - - public Method FindMethod(String type_name, String name) { - return _original.find_method(type_name, name); - } - - public Field GetField(UInt32 index) { - return _original.get_field(index); - } - - public Field FindField(String type_name, String name) { - return _original.find_field(type_name, name); - } - - public Property GetProperty(UInt32 index) { - return _original.get_property(index); - } -} diff --git a/csharp-api/test/Test/TypeDefinitionWrapper.cs b/csharp-api/test/Test/TypeDefinitionWrapper.cs deleted file mode 100644 index 01bbe7447..000000000 --- a/csharp-api/test/Test/TypeDefinitionWrapper.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using reframework; - -public class TypeDefinitionWrapper -{ - private readonly reframework.API.TypeDefinition _original; - - public TypeDefinitionWrapper(API.TypeDefinition original) - { - _original = original; - } - - - public UInt32 GetIndex() - { - return _original.get_index(); - } - - public UInt32 GetSize() - { - return _original.get_size(); - } - - public UInt32 GetValuetypeSize() - { - return _original.get_valuetype_size(); - } - - public UInt32 GetFqn() - { - return _original.get_fqn(); - } - - public String GetName() - { - return _original.get_name(); - } - - public String GetNamespace() - { - return _original.get_namespace(); - } - - public String GetFullName() - { - return _original.get_full_name(); - } - - public Boolean HasFieldptrOffset() - { - return _original.has_fieldptr_offset(); - } - - public Int32 GetFieldptrOffset() - { - return _original.get_fieldptr_offset(); - } - - public UInt32 GetNumMethods() - { - return _original.get_num_methods(); - } - - public UInt32 GetNumFields() - { - return _original.get_num_fields(); - } - - public UInt32 GetNumProperties() - { - return _original.get_num_properties(); - } - - public Boolean IsDerivedFrom(String other) - { - return _original.is_derived_from(other); - } - - public Boolean IsDerivedFrom(reframework.API.TypeDefinition other) - { - return _original.is_derived_from(other); - } - - public Boolean IsDerivedFrom(TypeDefinitionWrapper other) { - return _original.is_derived_from(other._original); - } - - public Boolean IsValuetype() - { - return _original.is_valuetype(); - } - - public Boolean IsEnum() - { - return _original.is_enum(); - } - - public Boolean IsByRef() - { - return _original.is_by_ref(); - } - - public Boolean IsPointer() - { - return _original.is_pointer(); - } - - public Boolean IsPrimitive() - { - return _original.is_primitive(); - } - - public UInt32 GetVmObjType() - { - return _original.get_vm_obj_type(); - } - - public MethodWrapper FindMethod(String name) - { - return new MethodWrapper(_original.find_method(name)); - } - - public API.Field FindField(String name) - { - return _original.find_field(name); - } - - public API.Property FindProperty(String name) - { - return _original.find_property(name); - } - - public List GetMethods() - { - var methods = _original.get_methods(); - var result = new List(); - foreach (var method in methods) { - result.Add(new MethodWrapper(method)); - } - - return result; - } - - public List GetFields() - { - return _original.get_fields(); - } - - public List GetProperties() - { - return _original.get_properties(); - } - - /*public Void* GetInstance() - { - return _original.get_instance(); - } - - public Void* CreateInstanceDeprecated() - { - return _original.create_instance_deprecated(); - }*/ - - public API.ManagedObject CreateInstance(Int32 flags) - { - return _original.create_instance(flags); - } - - public TypeDefinitionWrapper GetParentType() - { - return new TypeDefinitionWrapper(_original.get_parent_type()); - } - - public TypeDefinitionWrapper GetDeclaringType() - { - return new TypeDefinitionWrapper(_original.get_declaring_type()); - } - - public TypeDefinitionWrapper GetUnderlyingType() - { - return new TypeDefinitionWrapper(_original.get_underlying_type()); - } - - public API.TypeInfo GetTypeInfo() - { - return _original.get_type_info(); - } - - public API.ManagedObject GetRuntimeType() - { - return _original.get_runtime_type(); - } -}