예제 #1
0
        public static List <Data> GetDataByArray()
        {
            var    resultList = new List <Data>();
            IntPtr data;
            int    count;

            NativeLib.GetDataByArray(out data, out count);

            var pos = new IntPtr(data.ToInt64());

            for (int i = 0; i < count; i++)
            {
                resultList.Add(Data.PtrToThis(pos));
                pos = IntPtr.Add(pos, Marshal.SizeOf <Data>());
                Console.WriteLine($"{resultList.Last<Data>().info} - {resultList.Last<Data>().subInfo} - { resultList.Last<Data>().messageStr}");;
            }

            return(resultList);
        }
예제 #2
0
        public static List <Data> GetData()
        {
            var resultList = new List <Data>();

            // Get structure list from C++
            IntPtr data;

            NativeLib.GetData(out data);

            // Add in List at C#
            if (data != IntPtr.Zero)
            {
                var currentData = Data.PtrToThis(data);
                do
                {
                    Console.WriteLine($"{currentData.info} - {currentData.subInfo} - {currentData.messageStr}");
                    resultList.Add(currentData);
                    currentData = currentData.GetNext;
                } while (currentData != null);
                resultList.Remove(null);
            }

            return(resultList);
        }
예제 #3
0
 public static int Add(int a, int b)
 {
     return(NativeLib.add(a, b));
 }
예제 #4
0
 public static void Clean()
 {
     NativeLib.Cleanup();
 }