public static Tuple <string, string, string> GetAvUtiConformance(this NSUrl filePath) { NSError error; NSObject typeValue; if (filePath.TryGetResource(NSUrl.TypeIdentifierKey, out typeValue, out error)) { var typeValueString = typeValue as NSString; if (typeValueString != null) { if (UTType.ConformsTo(typeValueString, UTType.Movie)) { if (UTType.ConformsTo(typeValueString, UTType.MPEG4)) { return(new Tuple <string, string, string> (UTType.Movie, UTType.MPEG4, filePath.LastPathComponent)); } if (UTType.ConformsTo(typeValueString, UTType.QuickTimeMovie)) { return(new Tuple <string, string, string> (UTType.Movie, UTType.QuickTimeMovie, filePath.LastPathComponent)); } // alert that file is recognized as a movie, but we don't handle it (yet) log it return(new Tuple <string, string, string> (UTType.Movie, UTType.Movie, filePath.LastPathComponent)); } if (UTType.ConformsTo(typeValueString, UTType.Audio)) { if (UTType.ConformsTo(typeValueString, UTType.MP3)) { return(new Tuple <string, string, string> (UTType.Audio, UTType.MP3, filePath.LastPathComponent)); } if (UTType.ConformsTo(typeValueString, UTType.WaveformAudio)) { return(new Tuple <string, string, string> (UTType.Audio, UTType.WaveformAudio, filePath.LastPathComponent)); } // alert that file is recognized as a audio, but we don't handle it (yet) log it return(new Tuple <string, string, string> (UTType.Audio, UTType.Audio, filePath.LastPathComponent)); } } } else if (error != null) { //Log.Debug ($"Error trying to get resource identifier\n\t{error.Code}\n\t{error.Domain}\n\t{error.Description}"); return(new Tuple <string, string, string> (UTType.PlainText, $"Error trying to get resource identifier\n\t{error.Code}\n\t{error.Domain}\n\t{error.Description}", filePath.LastPathComponent)); } return(new Tuple <string, string, string> (UTType.PlainText, $"Unsupported file type or path", filePath.LastPathComponent)); }
private bool CanConformsToImageUTI(NSString url) { var uti = UTType.CreatePreferredIdentifier(UTType.TagClassFilenameExtension, url.PathExtension, null); return(UTType.ConformsTo(uti, UTType.Image)); }
public bool ConformsTo(string other) => other is null ? false : UTType.ConformsTo(Id, other);
// Required method for BookUI mode of NSPageController // We have different cards for image files and everything else. // Therefore, we have different identifiers public override string GetIdentifier(NSPageController pv, NSObject obj) { var fileObj = (FileObject)obj; return(UTType.ConformsTo(fileObj.UtiType, UTType.Image) ? kImageNibname : kNibName); }
public bool ConformsTo(UTI other) => other is null ? false : UTType.ConformsTo(Id, other.Id);