示例#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();
 }