Tim Mowrer
6 年前
当前提交
519a2e94
共有 6 个文件被更改,包括 0 次插入 和 149 次删除
-
22Assets/Scripts/Multipeer/NativeCode/NSMutableData-C-Bridge.m
-
37Assets/Scripts/Multipeer/NativeCode/NSMutableData-C-Bridge.m.meta
-
53Assets/Scripts/Multipeer/NSMutableData.cs
-
11Assets/Scripts/Multipeer/NSMutableData.cs.meta
-
15Assets/Scripts/Multipeer/NSMutableDataExtensions.cs
-
11Assets/Scripts/Multipeer/NSMutableDataExtensions.cs.meta
|
|||
#import <Foundation/Foundation.h> |
|||
|
|||
void* UnityMultipeer_NSMutableData_init() |
|||
{ |
|||
NSMutableData* data = [[NSMutableData alloc] init]; |
|||
return (__bridge_retained void*)data; |
|||
} |
|||
|
|||
void* UnityMultipeer_NSMutableData_initWithBytes(const void* bytes, int length) |
|||
{ |
|||
NSMutableData* data = [[NSMutableData alloc] initWithBytes:bytes |
|||
length:length]; |
|||
return (__bridge_retained void*)data; |
|||
} |
|||
|
|||
void* UnityMultipeer_NSMutableData_initWithBytesNoCopy(void* bytes, int length, bool freeWhenDone) |
|||
{ |
|||
NSMutableData* data = [[NSMutableData alloc] initWithBytesNoCopy:bytes |
|||
length:length |
|||
freeWhenDone:freeWhenDone]; |
|||
return (__bridge_retained void*)data; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3fc8bc4bd641e4dfcb418cd41edf6b64 |
|||
PluginImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
iconMap: {} |
|||
executionOrder: {} |
|||
defineConstraints: [] |
|||
isPreloaded: 0 |
|||
isOverridable: 0 |
|||
isExplicitlyReferenced: 0 |
|||
validateReferences: 1 |
|||
platformData: |
|||
- first: |
|||
Any: |
|||
second: |
|||
enabled: 0 |
|||
settings: {} |
|||
- first: |
|||
Editor: Editor |
|||
second: |
|||
enabled: 0 |
|||
settings: |
|||
DefaultValueInitialized: true |
|||
- first: |
|||
iPhone: iOS |
|||
second: |
|||
enabled: 1 |
|||
settings: {} |
|||
- first: |
|||
tvOS: tvOS |
|||
second: |
|||
enabled: 1 |
|||
settings: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace Unity.iOS.Multipeer |
|||
{ |
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct NSMutableData : IDisposable, IEquatable<NSMutableData> |
|||
{ |
|||
IntPtr m_Ptr; |
|||
|
|||
internal NSMutableData(IntPtr existing) => m_Ptr = existing; |
|||
|
|||
public bool Created => m_Ptr != IntPtr.Zero; |
|||
|
|||
public NSData ToNSData() => new NSData(m_Ptr); |
|||
|
|||
// public void Append(IntPtr bytes, int length)
|
|||
// {
|
|||
// if (!Created)
|
|||
// throw new InvalidOperationException($"Cannot append to the {typeof(NSMutableData).Name} because it has not been created.");
|
|||
|
|||
// Append(m_Ptr, bytes, length);
|
|||
// }
|
|||
|
|||
// public static NSMutableData CreateEmpty() => new NSMutableData(Init());
|
|||
|
|||
// public static NSMutableData CreateWithBytes(IntPtr bytes, int length)
|
|||
// => new NSMutableData(InitWithBytes(bytes, length));
|
|||
|
|||
// public static NSMutableData CreateWithBytesNoCopy(IntPtr bytes, int length, bool freeBytesOnDisposal = false)
|
|||
// => new NSMutableData(InitWithBytesNoCopy(bytes, length, freeBytesOnDisposal));
|
|||
|
|||
public void Dispose() => NativeApi.CFRelease(ref m_Ptr); |
|||
|
|||
public override int GetHashCode() => m_Ptr.GetHashCode(); |
|||
public override bool Equals(object obj) => (obj is NSMutableData) && Equals((NSMutableData)obj); |
|||
public bool Equals(NSMutableData other) => m_Ptr == other.m_Ptr; |
|||
public static bool operator==(NSMutableData lhs, NSMutableData rhs) => lhs.Equals(rhs); |
|||
public static bool operator!=(NSMutableData lhs, NSMutableData rhs) => !lhs.Equals(rhs); |
|||
|
|||
// [DllImport("__Internal", EntryPoint="UnityMultipeer_NSMutableData_init")]
|
|||
// static extern IntPtr Init();
|
|||
|
|||
// [DllImport("__Internal", EntryPoint="UnityMultipeer_NSMutableData_initWithBytes")]
|
|||
// static extern IntPtr InitWithBytes(IntPtr bytes, int length);
|
|||
|
|||
// [DllImport("__Internal", EntryPoint="UnityARKit_NSMutableData_initWithBytesNoCopy")]
|
|||
// static extern IntPtr InitWithBytesNoCopy(IntPtr bytes, int length, bool freeBytesOnDisposal);
|
|||
|
|||
// [DllImport("__Internal", EntryPoint="UnityARKit_NSMutableData_append")]
|
|||
// static extern IntPtr Append(IntPtr ptr, IntPtr bytes, int length);
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 57f6bd29a74244f9590efc743e8ee5df |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
|
|||
namespace Unity.iOS.Multipeer.Unsafe |
|||
{ |
|||
public static unsafe class NSMutableDataUnsafeUtility |
|||
{ |
|||
// public static NSMutableData CreateWithBytes(byte[] bytes, int offset, int length)
|
|||
// {
|
|||
// fixed(byte* ptr = &bytes[offset])
|
|||
// {
|
|||
// return NSMutableData.CreateWithBytes(new IntPtr(ptr), length);
|
|||
// }
|
|||
// }
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 169ce82dbd54c49d4ae6fb74311fa48c |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue