示例#1
0
        public static object GetData(this NSPasteboard pboard, string format, bool autoConvert)
        {
            switch (format)
            {
            case DataFormats.Text:
            case DataFormats.UnicodeText:
                return(pboard.GetStringForType(Pasteboard.NSPasteboardTypeText));

            case DataFormats.Rtf:
                return(pboard.GetRtf());

            case DataFormats.Html:
                return(pboard.GetHtml());

            case DataFormats.HtmlStream:
                return(pboard.GetHtml()?.ToStream(Encoding.UTF8));

            case Pasteboard.UniformResourceLocatorW:
                return(pboard.GetUri());

            case DataFormats.Bitmap:
                return(pboard.GetBitmap());

            case DataFormats.FileDrop:
                return(pboard.GetFileDrop());

            case "FilePromise":
                return(pboard.GetFilePromise());
            }

            return(null);
        }