Esempio n. 1
0
        /// <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;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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}");
 }
Esempio n. 5
0
        public void CreateTest()
        {
            string input = @"../../libtest.dll";

            try
            {
                using (dynamic native = NativeFactory.Create(input, CallingConvention.ThisCall))
                {
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 public static void FreePtrBlock(void *ptr, int size)
 {
     NativeFactory.GetPool(sizeof(void *) * size).Return(ptr);
 }
Esempio n. 9
0
 public static Circle **AllocPtrBlock(int size)
 {
     return((Circle **)NativeFactory.GetPool(sizeof(void *) * size).ForceGet());
 }
Esempio n. 10
0
 public static void ShutdownInternalTracer() => NativeFactory.ShutdownInternalTracer();
Esempio n. 11
0
 public static void StopInternalTracingCapture() => NativeFactory.StopInternalTracingCapture();
Esempio n. 12
0
 public PeerConnectionFactory()
 {
     _factory = NativeFactory.CreatePeerConnectionFactory();
 }
Esempio n. 13
0
        /*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));
        }
Esempio n. 14
0
 public static RTCCertificate GenerateCertificate(EncryptionKeyType keyType, long expires) =>
 NativeFactory.GenerateCertificate(keyType, expires);