unsafe static bool TrampolineApplyHandler(IntPtr block, string key, NWTxtRecordFindKey found, IntPtr value, nuint valueLen) { #if XAMCORE_4_0 var del = BlockLiteral.GetTarget <NWTxtRecordApplyDelegate> (block); #else var del = BlockLiteral.GetTarget <MulticastDelegate> (block); #endif if (del == null) { return(false); } var mValue = new ReadOnlySpan <byte> ((void *)value, (int)valueLen); #if XAMCORE_4_0 return(del(key, found, mValue)); #else if (del is NWTxtRecordApplyDelegate apply) { apply(key, found, mValue); return(true); } if (del is NWTxtRecordApplyDelegate2 apply2) { return(apply2(key, found, mValue)); } return(false); #endif }
unsafe static void TrampolineAccessKeyHandler(IntPtr block, string key, NWTxtRecordFindKey found, IntPtr value, nuint valueLen) { var del = BlockLiteral.GetTarget <NWTxtRecordGetValueDelegete> (block); if (del != null) { ReadOnlySpan <byte> mValue; if (found == NWTxtRecordFindKey.NonEmptyValue) { mValue = new ReadOnlySpan <byte>((void *)value, (int)valueLen); } else { mValue = Array.Empty <byte> (); } del(key, found, mValue); } }