本文整理汇总了C#中TypedPtr类的典型用法代码示例。如果您正苦于以下问题:C# TypedPtr类的具体用法?C# TypedPtr怎么用?C# TypedPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedPtr类属于命名空间,在下文中一共展示了TypedPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DirectoryClose
public static int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
{
return AFCDirectoryClose((IntPtr)conn, dir);
}
示例2: MobileDeviceInstance
/// <summary>
/// Creates a new iPhone object. If an iPhone is connected to the computer, a connection will automatically be opened.
/// </summary>
public MobileDeviceInstance(TypedPtr<AppleMobileDeviceConnection> Connection)
{
iPhoneHandle = Connection;
doConstruction();
}
示例3: ConvertCFDictionaryToDictionary
/// <summary>
/// Converts a CFDictionary into a Dictionary (keys and values are object)
/// </summary>
public static Dictionary<object, object> ConvertCFDictionaryToDictionary(TypedPtr<CFDictionary> Dict)
{
// Get the raw key-value pairs
int NumPairs = CFDictionaryGetCount(Dict);
IntPtr [] Keys = new IntPtr[NumPairs];
IntPtr [] Values = new IntPtr[NumPairs];
CFDictionaryGetKeysAndValues((IntPtr)Dict, Keys, Values);
// Convert each key and value to a managed type
Dictionary<object, object> Result = new Dictionary<object, object>();
for (int i = 0; i < NumPairs; ++i)
{
try
{
Result.Add(ConvertArbitraryCFType(Keys[i]), ConvertArbitraryCFType(Values[i]));
}
catch (Exception)
{
Console.WriteLine("Unable to properly convert dictionary");
}
}
return Result;
}
示例4: ConvertCFNumber
/// <summary>
/// Converts an arbitrary CFNumber to a double
/// </summary>
public static double ConvertCFNumber(TypedPtr<CFNumber> Number)
{
CFNumberType TypeID = CFNumberGetType((IntPtr)Number);
switch (TypeID)
{
case CFNumberType.kCFNumberFloat32Type:
case CFNumberType.kCFNumberFloatType:
{
float Result;
CFNumberGetValue((IntPtr)Number, CFNumberType.kCFNumberFloat32Type, out Result);
return Result;
}
case CFNumberType.kCFNumberFloat64Type:
case CFNumberType.kCFNumberDoubleType:
case CFNumberType.kCFNumberCGFloatType:
{
double Result;
CFNumberGetValue((IntPtr)Number, CFNumberType.kCFNumberFloat64Type, out Result);
return Result;
}
case CFNumberType.kCFNumberSInt8Type:
case CFNumberType.kCFNumberSInt16Type:
case CFNumberType.kCFNumberSInt32Type:
case CFNumberType.kCFNumberCharType:
case CFNumberType.kCFNumberShortType:
case CFNumberType.kCFNumberIntType:
case CFNumberType.kCFNumberLongType:
case CFNumberType.kCFNumberCFIndexType:
{
int Result;
CFNumberGetValue((IntPtr)Number, CFNumberType.kCFNumberIntType, out Result);
return Result;
}
case CFNumberType.kCFNumberSInt64Type:
case CFNumberType.kCFNumberLongLongType:
case CFNumberType.kCFNumberNSIntegerType:
{
Int64 Result;
CFNumberGetValue((IntPtr)Number, CFNumberType.kCFNumberSInt64Type, out Result);
return Result;
}
default:
return 0.0;
}
}
示例5: CFDictionaryAddHelper
public static void CFDictionaryAddHelper(TypedPtr<CFDictionary> InDict, string Key, string Value)
{
CFDictionarySetValue((IntPtr)InDict, (IntPtr)CFStringMakeConstantString(Key), (IntPtr)CFStringMakeConstantString(Value));
}
示例6: CFStringGetCString
public static string CFStringGetCString(TypedPtr<CFString> InString)
{
byte[] bytes = new byte[2048];
CFStringGetCString(InString.Handle, bytes, 2048, CFStringBuiltInEncodings.kCFStringEncodingUTF8);
int ValidLength = 0;
foreach (byte b in bytes)
{
if (b == 0)
{
break;
}
else
{
ValidLength++;
}
}
return Encoding.UTF8.GetString(bytes, 0, ValidLength);
}
示例7: FileRefOpen
public static int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
{
return AFCFileRefOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), mode, out handle);
}
示例8: FileRefRead
public static int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
{
return AFCFileRefRead((IntPtr)conn, handle, buffer, ref len);
}
示例9: FileInfoOpen
public static int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
{
IntPtr UntypedDict;
int Result = AFCFileInfoOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), out UntypedDict);
OutDict = UntypedDict;
return Result;
}
示例10: FileRefClose
public static int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
{
return AFCFileRefClose((IntPtr)conn, handle);
}
示例11: DirectoryRead
public static int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
{
return AFCDirectoryRead((IntPtr)conn, dir, ref dirent);
}
示例12: DirectoryOpen
public static int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
{
return AFCDirectoryOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), ref dir);
}
示例13: DirectoryCreate
public static int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
{
return AFCDirectoryCreate((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
}
示例14: RemovePath
public static int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
{
return AFCRemovePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
}
示例15: FileRefSetFileSize
public static int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
{
return AFCFileRefSetFileSize((IntPtr)conn, handle, size);
}