Beispiel #1
0
 static CarbonEventHandlerStatus HandleOpenUrls(IntPtr callRef, IntPtr eventRef, IntPtr user_data)
 {
     try {
         var urls = Carbon.GetUrlListFromEventRef(eventRef);
         var args = new ApplicationUrlEventArgs(urls);
         openUrls(null, args);
         return(args.HandledStatus);
     } catch (Exception ex) {
         System.Console.WriteLine(ex);
         return(CarbonEventHandlerStatus.NotHandled);
     }
 }
Beispiel #2
0
        public static List <string> GetUrlListFromEventRef(IntPtr eventRef)
        {
            AEDesc list  = GetEventParameter <AEDesc> (eventRef, CarbonEventParameterName.DirectObject, CarbonEventParameterType.AEList);
            long   count = AECountItems(ref list);
            var    files = new List <string> ();

            for (int i = 1; i <= count; i++)
            {
                string url = GetStringFromAEPtr(ref list, i);
                if (!string.IsNullOrEmpty(url))
                {
                    files.Add(url);
                }
            }
            Carbon.CheckReturn(Carbon.AEDisposeDesc(ref list));
            return(files);
        }