public static extern void MDataInfoEncryptEntryValueNative( IntPtr appPtr, ulong infoH, IntPtr inputPtr, IntPtr inputLen, IntPtr self, MDataInfoEncryptEntryValueCb callback);
public void MDataInfoEncryptEntryValue( IntPtr appPtr, ulong infoH, IntPtr inputPtr, IntPtr inputLen, IntPtr self, MDataInfoEncryptEntryValueCb callback) { MDataInfoEncryptEntryValueNative(appPtr, infoH, inputPtr, inputLen, self, callback); }
public static Task <List <byte> > MDataInfoEncryptEntryValueAsync(ulong infoH, List <byte> inputBytes) { var tcs = new TaskCompletionSource <List <byte> >(); var inputBytesPtr = inputBytes.ToIntPtr(); MDataInfoEncryptEntryValueCb callback = null; callback = (self, result, dataPtr, dataLen) => { if (result.ErrorCode != 0) { tcs.SetException(result.ToException()); CallbackManager.Unregister(callback); return; } var data = dataPtr.ToList <byte>(dataLen); tcs.SetResult(data); CallbackManager.Unregister(callback); }; CallbackManager.Register(callback); NativeBindings.MDataInfoEncryptEntryValue(Session.AppPtr, infoH, inputBytesPtr, (IntPtr)inputBytes.Count, Session.UserData, callback); Marshal.FreeHGlobal(inputBytesPtr); return(tcs.Task); }