示例#1
0
 static public CFUrl FromUrlString(string url, CFUrl baseurl)
 {
     // CFString ctor will throw an ANE if null
     using (var str = new CFString(url)){
         return(FromStringHandle(str.Handle, baseurl));
     }
 }
示例#2
0
        internal static CFUrl FromStringHandle(IntPtr cfstringHandle, CFUrl baseurl)
        {
            IntPtr handle = CFURLCreateWithString(IntPtr.Zero, cfstringHandle, baseurl != null ? baseurl.Handle : IntPtr.Zero);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new CFUrl(handle));
        }
示例#3
0
		internal static CFUrl FromStringHandle (IntPtr cfstringHandle, CFUrl baseurl)
		{
			IntPtr handle = CFURLCreateWithString (IntPtr.Zero, cfstringHandle, baseurl != null ? baseurl.Handle : IntPtr.Zero);
			if (handle == IntPtr.Zero)
				return null;
			return new CFUrl (handle);
		}
示例#4
0
		static public CFUrl FromUrlString (string url, CFUrl baseurl)
		{
			// CFString ctor will throw an ANE if null
			using (var str = new CFString (url)){
				return FromStringHandle (str.Handle, baseurl);
			}
		}
示例#5
0
        public static ExtAudioFile OpenUrl(CFUrl url)
        {
            if (url == null)
                throw new ArgumentNullException ("url");

            ExtAudioFileError err;
            var audioFile = OpenUrl (url.Handle, out err);

            if (err != ExtAudioFileError.OK) // if (err != 0)  <- to keep old implementation
                throw new ArgumentException (String.Format ("Error code:{0}", err));
            if (audioFile == null) // if (ptr == IntPtr.Zero)  <- to keep old implementation
                throw new InvalidOperationException ("Can not get object instance");

            return audioFile;
        }
示例#6
0
        public static ExtAudioFile OpenUrl(CFUrl url, out ExtAudioFileError error)
        {
            if (url == null)
                throw new ArgumentNullException ("url");

            return OpenUrl (url.Handle, out error);
        }
示例#7
0
        public static ExtAudioFile CreateWithUrl(CFUrl url,
            AudioFileType fileType,
            AudioStreamBasicDescription inStreamDesc,
            //AudioChannelLayout channelLayout,
            AudioFileFlags flag)
        {
            if (url == null)
                throw new ArgumentNullException ("url");

            ExtAudioFileError err;
            var audioFile = CreateWithUrl (url.Handle, fileType, inStreamDesc, flag, out err);

            if (err != ExtAudioFileError.OK) // if (err != 0)  <- to keep old implementation
                throw new ArgumentException (String.Format ("Error code:{0}", err));
            if (audioFile == null) // if (ptr == IntPtr.Zero)  <- to keep old implementation
                throw new InvalidOperationException ("Can not get object instance");

            return audioFile;
        }
示例#8
0
        public static ExtAudioFile CreateWithUrl(CFUrl url, AudioFileType fileType, AudioStreamBasicDescription inStreamDesc, AudioFileFlags flag,	out ExtAudioFileError error)
        {
            if (url == null)
                throw new ArgumentNullException ("url");

            return CreateWithUrl (url.Handle, fileType, inStreamDesc, flag, out error);
        }