Esempio n. 1
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer?targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference))
            {
                if (targetBuffer is null)
                {
                    ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(targetBuffer));
                }
            }

            return(CMBlockBufferAppendBufferReference(GetCheckedHandle(), targetBuffer.GetHandle(), offsetToData, dataLength, flags));
        }
Esempio n. 2
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
            {
                throw new ObjectDisposedException("BlockBuffer");
            }

            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference))
            {
                if (targetBuffer == null)
                {
                    throw new ArgumentNullException("targetBuffer");
                }
            }

            return(CMBlockBufferAppendBufferReference(Handle, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags));
        }
Esempio n. 3
0
        public static CMBlockBuffer FromBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error)
        {
            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference))
            {
                if (targetBuffer == null)
                {
                    throw new ArgumentNullException("targetBuffer");
                }
            }

            IntPtr buffer;

            error = CMBlockBufferCreateWithBufferReference(IntPtr.Zero, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags, out buffer);
            if (error != CMBlockBufferError.None)
            {
                return(null);
            }

            return(new CMBlockBuffer(buffer, true));
        }
Esempio n. 4
0
        public static CMBlockBuffer?FromBuffer(CMBlockBuffer?targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error)
        {
            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag(CMBlockBufferFlags.PermitEmptyReference))
            {
                if (targetBuffer is null)
                {
                    ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(targetBuffer));
                }
            }

            IntPtr buffer;

            error = CMBlockBufferCreateWithBufferReference(IntPtr.Zero, targetBuffer.GetHandle(), offsetToData, dataLength, flags, out buffer);
            if (error != CMBlockBufferError.None)
            {
                return(null);
            }

            return(new CMBlockBuffer(buffer, true));
        }
Esempio n. 5
0
        public CMBlockBufferError AppendBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags)
        {
            if (Handle == IntPtr.Zero)
                throw new ObjectDisposedException ("BlockBuffer");

            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag (CMBlockBufferFlags.PermitEmptyReference)) {
                if (targetBuffer == null)
                    throw new ArgumentNullException ("targetBuffer");
            }

            return CMBlockBufferAppendBufferReference (Handle, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags);
        }
Esempio n. 6
0
        public static CMBlockBuffer FromBuffer(CMBlockBuffer targetBuffer, nuint offsetToData, nuint dataLength, CMBlockBufferFlags flags, out CMBlockBufferError error)
        {
            // From docs targetBuffer must not be null unless the PermitEmptyReference flag is set
            if (!flags.HasFlag (CMBlockBufferFlags.PermitEmptyReference))
                if (targetBuffer == null)
                    throw new ArgumentNullException ("targetBuffer");

            IntPtr buffer;
            error = CMBlockBufferCreateWithBufferReference (IntPtr.Zero, targetBuffer == null ? IntPtr.Zero : targetBuffer.handle, offsetToData, dataLength, flags, out buffer);
            if (error != CMBlockBufferError.None)
                return null;

            return new CMBlockBuffer (buffer, true);
        }