Пример #1
0
 /// <summary>
 /// <para>Appends to the receiver a given number of bytes from a given buffer.</para>
 /// <para>Original signature is '- (void)appendBytes:(const void *)bytes length:(NSUInteger )length'</para>
 /// <para>Available in Mac OS X v10.0 and later.</para>
 /// </summary>
 /// <param name="bytes">A buffer containing data to append to the receiver's content.</param>
 /// <param name="length">The number of bytes from bytes to append.</param>
 /// <returns>An initialized NSMutableData object capable of holding capacity bytes.</returns>
 public void AppendBytesLength(byte[] bytes, NSUInteger length)
 {
     IntPtr pointer = Marshal.AllocHGlobal((int) length);
     Marshal.Copy(bytes, 0, pointer, (int) length);
     this.AppendBytesLength(pointer, length);
     Marshal.FreeHGlobal(pointer);
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NSData"/> class.
 /// </summary>
 /// <param name="bytes">The bytes.</param>
 /// <param name="length">The length.</param>
 public NSData(byte[] bytes, NSUInteger length) : this(ObjectiveCRuntime.SendMessage<IntPtr>(NSDataClass, "alloc"))
 {
     IntPtr pointer = Marshal.AllocHGlobal((int)length);
     Marshal.Copy(bytes, 0, pointer, (int)length);
     
     if (ObjectiveCRuntime.Is64Bits)
     {
         this.NativePointer = ObjectiveCRuntime.SendMessage<IntPtr>(this, "initWithBytes:length:", pointer, (ulong)length);
     }
     else
     {
         this.NativePointer = ObjectiveCRuntime.SendMessage<IntPtr>(this, "initWithBytes:length:", pointer, (uint)length);
     }
     
     Marshal.FreeHGlobal(pointer);
 }
Пример #3
0
 /// <summary>
 /// <para>Creates and returns a data object containing a given number of bytes copied from a given buffer.</para>
 /// <para>Original signature is '+ (id)dataWithBytes:(const void *)bytes length:(NSUInteger)length'</para>
 /// <para>Available in OS X v10.0 and later.</para>
 /// </summary>
 /// <param name="bytes">A buffer containing data for the new object.</param>
 /// <param name="length">The number of bytes to copy from bytes. This value must not exceed the length of bytes.</param>
 /// <returns>A data object containing length bytes copied from the buffer bytes. Returns nil if the data object could not be created.</returns>
 public static NSData DataFromBytes(byte[] bytes, NSUInteger length)
 {
     IntPtr pointer = Marshal.AllocHGlobal((int)length);
     Marshal.Copy(bytes, 0, pointer, (int)length);
     NSData data = NSData.DataWithBytesLength(pointer, length);
     Marshal.FreeHGlobal(pointer);
     return data;
 }
Пример #4
0
        /// <summary>
        /// Creates a new NSRange from the specified values.
        /// </summary>
        /// <remarks>Original declaration is : NSRange NSMakeRange(unsigned int location, unsigned int length)</remarks>
		public static NSRange NSMakeRange(NSUInteger location,
		                                  NSUInteger length)
        {
            return new NSRange(location, length);
        }
Пример #5
0
        /// <summary>
        /// Returns a Boolean value that indicates whether a specified position is in a given range.
        /// </summary>
        /// <remarks>Original declaration is : BOOL NSLocationInRange(unsigned int index, NSRange aRange)</remarks>
		public static bool NSLocationInRange(NSUInteger index, NSRange aRange)
        {
            return ((index >= aRange.location) && (index < (aRange.location + aRange.length)));
        }
Пример #6
0
		public static NSDecimal FromUnsignedInteger (NSUInteger value)
		{
			return NSNumber.NumberWithUnsignedInteger (value).DecimalValue;
		}
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NSPurgeableData"/> class.
 /// </summary>
 /// <param name="bytes">The bytes.</param>
 /// <param name="length">The length.</param>
 public NSPurgeableData(byte[] bytes, NSUInteger length)
     : base(bytes, length) {}
Пример #8
0
		/// <summary>
		/// <para>Multiplies a 4x4 matrix by an array of 4-component vectors.</para>
		/// <para>Original signature is 'void GLKMatrix4.MultiplyVector4Array ( GLKMatrix4 matrix, GLKVector4 *vectors, size_t vectorCount );'</para>
		/// <para>Available in OS X v10.8 and later.</para>
		/// </summary>
		/// <param name="matrix">MISSING</param>
		/// <param name="vectors">MISSING</param>
		/// <param name="vectorCount">MISSING</param>
		public static void MultiplyVector4Array (GLKMatrix4 matrix, IntPtr vectors, NSUInteger vectorCount)
		{
			throw new NotImplementedException ();
		}
Пример #9
0
 public virtual NSNumber NumberForPlotFieldRecordIndex(CPTPlot plot, NSUInteger fieldEnum, NSUInteger index)
 {
     NSNumber num = plotData.ObjectAtIndex<NSDictionary>(index).ObjectForKey<NSNumber>(NSNumber.NumberWithUnsignedInteger (fieldEnum));
     return num;
 }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Monobjc.Foundation.NSRange64"/> struct.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <param name="length">The length.</param>
		public NSRange64(NSUInteger location, NSUInteger length)
        {
            this.location = location;
            this.length = length;
        }