string ExtractReceivedDataFromAttachments(NSObject[] attachments) { var localFilePath = new NSString(attachments [0].ToString()); Console.WriteLine("Local File Path: {0}", localFilePath); if (!GDFileSystem.FileExistsAtPath(localFilePath, false)) { ReportError(_application, _requestId, "Attachment was not found", (int)GDServicesError.GDServicesErrorInvalidParams); return(string.Empty); } NSError error = null; NSData attachmentData = GDFileSystem.ReadFromFile(localFilePath, out error); if (error != null) { var description = string.Format("Error Reading attachement: {0} {1}", localFilePath, error.LocalizedDescription); ReportError(_application, _requestId, description, (int)GDServicesError.GDServicesErrorInvalidParams); return(string.Empty); } return(new NSString(attachmentData.ToString(), NSStringEncoding.UTF8).ToString()); }
public bool FileExists(string filePath, bool isDirectory) { return(GDFileSystem.FileExistsAtPath(filePath, isDirectory)); }