void GetUrlWithReplyEvent(NSAppleEventDescriptor @event, NSAppleEventDescriptor replyEvent) { // from /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/Headers/AppleEvents.h const uint keyDirectObject = 757935405; // '----' const uint keyErrorNumber = 1701999214; // 'errn' const uint keyErrorString = 1701999219; // 'errs' string errorMessage = null; var urlString = @event?.ParamDescriptorForKeyword(keyDirectObject).StringValue; if (urlString != null) { SessionDocumentController .SharedDocumentController .OpenDocument(new NSUrl(urlString)); applicationShouldOpenUntitledFile = false; } replyEvent.SetParamDescriptorforKeyword( NSAppleEventDescriptor.DescriptorWithInt32(errorMessage == null ? 0 : 1), keyErrorNumber); if (errorMessage != null) { replyEvent.SetParamDescriptorforKeyword( NSAppleEventDescriptor.DescriptorWithString(errorMessage), keyErrorString); } }
void GetCurrentSelectedSolutionPath(NSAppleEventDescriptor @event, NSAppleEventDescriptor reply) { LoggingService.LogInfo($"{nameof (GetCurrentSelectedSolutionPath)}: received AppleEvent {@event}"); var solutionPath = IdeApp.Workspace.CurrentSelectedSolution?.FileName.FullPath.ToString(); if (!string.IsNullOrEmpty(solutionPath)) { reply.SetParamDescriptorforKeyword( NSAppleEventDescriptor.DescriptorWithString(solutionPath), keyDirectObject); LoggingService.LogInfo($"{nameof (GetCurrentSelectedSolutionPath)}: replying to AppleEvent {@event} with {solutionPath}"); } }