// //------------------------------------------------------------------------------
// //
// // Copyright © Dascoba Development 2010
// //
// //------------------------------------------------------------------------------
namespace Dascoba.Umb.FileManager.Support
{
using System;
using System.IO;
using System.Linq;
public static class Util
{
///
/// Gets the file size text.
///
/// The size in bytes.
///
internal static string GetFileSizeText(long sizeInBytes)
{
var sizeText = sizeInBytes + " Bytes";
if (sizeInBytes > 1024 && sizeInBytes < 1048576)
{
sizeText = (sizeInBytes / 1024) + " KB";
}
if (sizeInBytes > 1048576 && sizeInBytes < 1073741824)
{
sizeText = (sizeInBytes / 1024 / 1024) + " MB";
}
if (sizeInBytes > 1073741824 && sizeInBytes < 1099511627776)
{
sizeText = (sizeInBytes / 1024 / 1024) + " GB";
}
return sizeText;
}
}
}