コード例 #1
0
ファイル: Extensions.cs プロジェクト: emclient/mac-playground
        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);
        }