Пример #1
0
        public static void Restore(String fileName)
        {
            Clipboard.Empty();

            var reader = new ClipboardFileReader();

            using (var clipboard = new ClipboardApi())
            {
                reader.EntryRead += (s, e) =>
                {
                    var data = reader.ReadData();
                    clipboard.SetData(e.Entry.Id, data);
                };

                reader.Read(fileName);
            }
        }
Пример #2
0
        public static String GetText(String fileName)
        {
            var reader = new ClipboardFileReader();

            String text = null;
            reader.EntryRead += (s, e) =>
            {
                if (ClipboardText.IsTextFormat(e.Entry.Id))
                {
                    var data = reader.ReadData();
                    text = ClipboardText.ExtractText(e.Entry.Id, data);
                    e.Cancel = true;
                }
            };

            reader.Read(fileName);

            return text;
        }