mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-07-15 23:13:33 +08:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
![]() |
using CPF.Mac.Foundation;
|
||
|
using CPF.Mac.ObjCRuntime;
|
||
|
using System;
|
||
|
|
||
|
namespace CPF.Mac.CoreFoundation
|
||
|
{
|
||
|
public static class CFExceptionDataKey
|
||
|
{
|
||
|
public static readonly NSString Description;
|
||
|
|
||
|
public static readonly NSString LocalizedDescription;
|
||
|
|
||
|
public static readonly NSString LocalizedFailureReason;
|
||
|
|
||
|
public static readonly NSString LocalizedRecoverySuggestion;
|
||
|
|
||
|
public static readonly NSString UnderlyingError;
|
||
|
|
||
|
static CFExceptionDataKey()
|
||
|
{
|
||
|
IntPtr intPtr = Dlfcn.dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", 0);
|
||
|
if (!(intPtr == IntPtr.Zero))
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
Description = Dlfcn.GetStringConstant(intPtr, "kCFErrorDescriptionKey");
|
||
|
LocalizedDescription = Dlfcn.GetStringConstant(intPtr, "kCFErrorLocalizedDescriptionKey");
|
||
|
LocalizedFailureReason = Dlfcn.GetStringConstant(intPtr, "kCFErrorLocalizedFailureReasonKey");
|
||
|
LocalizedRecoverySuggestion = Dlfcn.GetStringConstant(intPtr, "kCFErrorLocalizedRecoverySuggestionKey");
|
||
|
UnderlyingError = Dlfcn.GetStringConstant(intPtr, "kCFErrorUnderlyingErrorKey");
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
Dlfcn.dlclose(intPtr);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|