using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
// The 'text' parameter will contain the text from the:
// - Current Clipboard when run by HotKey
// - History Item when run from the History Menu
// The returned string will be:
// - Placed directly on the Clipboard
// - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
// Set the slot number here (it's 0 based, so 0 is slot 1, 1 is slot 2, etc)
int slotNumber = 0;
// Send the copy command
BFS.Clipboard.Copy();
// Put the item in the local pinned slot
if (BFS.Clipboard.HasText()) // Text
{
BFS.ClipboardFusion.SetLocalPinnedFileList(slotNumber, null);
BFS.ClipboardFusion.SetLocalPinnedImage(slotNumber, null);
BFS.ClipboardFusion.SetLocalPinnedText(slotNumber, BFS.Clipboard.GetText());
}
else if (BFS.Clipboard.HasImage()) // Image
{
BFS.ClipboardFusion.SetLocalPinnedFileList(slotNumber, null);
BFS.ClipboardFusion.SetLocalPinnedImage(slotNumber, (Bitmap)Clipboard.GetImage());
BFS.ClipboardFusion.SetLocalPinnedText(slotNumber, "Image");
}
else if (Clipboard.ContainsFileDropList()) // Files
{
string[] files = new string[Clipboard.GetFileDropList().Count];
Clipboard.GetFileDropList().CopyTo(files, 0);
string itemLabel = string.Join("\r\n", files);
BFS.ClipboardFusion.SetLocalPinnedFileList(slotNumber, files);
BFS.ClipboardFusion.SetLocalPinnedImage(slotNumber, null);
BFS.ClipboardFusion.SetLocalPinnedText(slotNumber, itemLabel);
}
return null;
}
}