/// <summary> /// Dispose /// </summary> public void Dispose() { foreach (var textFormat in TextFormats.Values) { textFormat.Dispose(); } TextFormats.Clear(); Brush?.Dispose(); TextFormat?.Dispose(); TextFormat = null; Brush?.Dispose(); Brush = null; Target?.Dispose(); Target = null; NativeDeviceContext.Target = null; NativeDeviceContext?.Dispose(); NativeDeviceContext = null; NativeDevice?.Dispose(); NativeDevice = null; NativeFactory?.Dispose(); NativeFactory = null; NativeFactoryWrite?.Dispose(); NativeFactoryWrite = null; }
public void DynamicFunction() { int input = 0; int result = -1; using (dynamic native = NativeFactory.Create(@"../../libtest.dll")) { result = native.test <int>(input); } Assert.AreEqual(input, result); }
public void AutoFunction() { int input = 0; int result = -1; using (var native = NativeFactory.Create(@"../../libtest.dll")) { result = native.Invoke <int>("test", input); } Assert.AreEqual(input, result); }
private void OnDestroy() { Debug.Log("Collision Quit :OnDestroy"); if (_quadTree != null) { _quadTree->Clear(); QuadTreeFactory.FreeQuadTree(_quadTree); _quadTree = null; } NativeFactory.Clear(); Debug.Log($"RemainMemSize: NativeHelper.MemSize {NativeHelper.MemSize}"); Debug.Assert(NativeHelper.MemSize == 0, $"NativeHelper.MemSize {NativeHelper.MemSize}"); }
public void CreateTest() { string input = @"../../libtest.dll"; try { using (dynamic native = NativeFactory.Create(input, CallingConvention.ThisCall)) { } } catch { throw; } }
public void CallingConventionFunction() { string input = @"../../libtest.dll"; try { using (var native = NativeFactory.Create(input)) { var result = native.Invoke <int>("test", CallingConvention.StdCall, input); } } catch { throw; } }
public void DelegateFunction() { int input = 0; int result = -1; using (var native = NativeFactory.Create(@"../../libtest.dll")) { using (var native1 = NativeFactory.Create(@"../../libtest.dll")) { var result1 = native1.Invoke <int, Test>(input); var test = native1.GetFunction <Test>(); result = test(input); } } Assert.AreEqual(input, result); }
public static void FreePtrBlock(void *ptr, int size) { NativeFactory.GetPool(sizeof(void *) * size).Return(ptr); }
public static Circle **AllocPtrBlock(int size) { return((Circle **)NativeFactory.GetPool(sizeof(void *) * size).ForceGet()); }
public static void ShutdownInternalTracer() => NativeFactory.ShutdownInternalTracer();
public static void StopInternalTracingCapture() => NativeFactory.StopInternalTracingCapture();
public PeerConnectionFactory() { _factory = NativeFactory.CreatePeerConnectionFactory(); }
/*protected TDel FindFunction<TDel>(string name, bool exact) where TDel : class * { * if(hmod == IntPtr.Zero) return null; * IntPtr proc = Native.GetProcAddress(hmod, name); * if(proc == IntPtr.Zero) * { * if(exact) throw new Win32Exception(); * proc = FindProcMangled(name); * } * * return Marshal.GetDelegateForFunctionPointer<TDel>(proc); * }*/ public static T Create <T>(string lib) where T : NativeLibrary { return(NativeFactory <T> .Create(lib)); }
public static RTCCertificate GenerateCertificate(EncryptionKeyType keyType, long expires) => NativeFactory.GenerateCertificate(keyType, expires);