using System;
using System.Collections.Generic;
// 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 when run as a Macro
// - Ignored by ClipboardFusion if it is 'null'
// - Passed along to the next action in a Trigger (null changed to an empty string)
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
// Clean up line breaks
text = text.Replace(Environment.NewLine, "\n")
.Replace("\0", "")
.Replace("\r", "");
// Get the lines from the text
string[] lines = text.Split(new [] {'\n'});
// Reverse the order of the lines so that they appear in the right order in this History
Array.Reverse(lines);
// Loop through the lines and add the cells to the History
foreach(string line in lines)
{
string[] cells = line.Split(new [] { '\t' });
Array.Reverse(cells);
foreach(string cell in cells)
BFS.ClipboardFusion.AddHistoryText(cell);
}
// Tell ClipboardFusion to ignore the result of this macro
return null;
}
}