using System;
using System.Net;
using System.IO;
using System.Windows.Forms;
class Utils
{
public static string FormatByte(long bytes)
{
string result = String.Empty;
if (bytes < 1024)
result = String.Format("{0} B", bytes);
else if (bytes < 1024 * 1024)
result = String.Format("{0:0.00} KB", (float)bytes / (1024));
else if (bytes < 1024 * 1024 * 1024)
result = String.Format("{0:0.00} MB", (float)bytes / (1024 * 1024));
else
result = String.Format("{0:0.00} GB", (float)bytes / (1024 * 1024 * 1024));
return result;
}
}