コード例 #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();
        }
コード例 #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);
        }