public static ClipboardEntry[] Parse(String fileName) { var reader = new ClipboardFileReader(); var entries = new List<ClipboardEntry>(); reader.EntryRead += (s, e) => { entries.Add(e.Entry); }; reader.Read(fileName); return entries.ToArray(); }
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); } }
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; }