Beispiel #1
0
 public static extern void tc_request(
     uint context,
     tc_string_data_t function_name,
     tc_string_data_t function_params_json,
     uint request_id,
     [MarshalAs(UnmanagedType.FunctionPtr)]
     tc_response_handler_t response_handler);
Beispiel #2
0
        public static string FromTonString(tc_string_data_t str)
        {
            var bytes = new byte[str.len];

            Marshal.Copy(str.content, bytes, 0, (int)str.len);
            return(Encoding.UTF8.GetString(bytes));
        }
Beispiel #3
0
        private static tc_string_data_t ToTonString(string str)
        {
            var bytes  = Encoding.UTF8.GetBytes(str);
            var length = bytes.Length;
            var result = new tc_string_data_t {
                content = Marshal.AllocHGlobal(length)
            };

            Marshal.Copy(bytes, 0, result.content, length);
            result.len = (uint)length;
            return(result);
        }
Beispiel #4
0
 public static extern IntPtr tc_request_sync(
     uint context,
     tc_string_data_t function_name,
     tc_string_data_t function_params_json);
Beispiel #5
0
 public static extern IntPtr tc_create_context(tc_string_data_t config);