using System;
using System.Text;
using System.Security.Cryptography;
// 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
{
static StringBuilder table = new StringBuilder(256);
static ClipboardFusionHelper()
{
for (int i = 33; i <= 126; ++i)
{
table.Append((char)i);
}
for (char ch = '\u00AE'; ch < '\u00AE' + (256 - (126 - 33 + 1)); ++ch)
{
table.Append(ch);
}
}
internal static string ToStr(byte[] byteArray)
{
string a = "";
foreach(byte b in byteArray)
{
a += table[b];
}
return a;
}
public static string ProcessText(string text)
{
using (RandomNumberGenerator rng = new RNGCryptoServiceProvider())
{
byte[] rngData = new byte[20];
rng.GetBytes(rngData);
BFS.ClipboardFusion.PauseClipboardListener();
BFS.Clipboard.PasteText(ToStr(rngData));
BFS.Clipboard.Clear();
BFS.ClipboardFusion.ResumeClipboardListener();
}
return null;
}
}