Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Console.WriteLine($"Add : {NativeLib.Add(1, 1).ToString()}");

            Console.WriteLine($"Replace string : {NativeLib.Replacestr("Password")}");

            Console.WriteLine($"Add string : {NativeLib.Addstr("Test")}");

            NativeLib.GetData();

            NativeLib.GetDataByArray();

            NativeLib.Clean();
        }
Ejemplo n.º 2
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);
        }