using System;
using System.IO;
using System.Windows.Forms;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
StringReader sr = new StringReader(text);
bool notAllValuesAreNumeric = false;
double summedValues = 0.0;
string lineStringVal;
lineStringVal= sr.ReadLine();
while (lineStringVal != null)
{
double val;
if (Double.TryParse(lineStringVal, out val))
summedValues += val;
else
notAllValuesAreNumeric = true;
lineStringVal = sr.ReadLine();
}
string message = "Sum: " + summedValues.ToString();
if (notAllValuesAreNumeric)
message += "\n!!!NOTE: Not All Values were numeric.!!!";
MessageBox.Show(message, "Sum of All Lines", MessageBoxButtons.OK, MessageBoxIcon.Information);
return summedValues.ToString();
}
}