RatioMaster_source.RM.FormatFileSize C# (CSharp) Method

FormatFileSize() static private method

static private FormatFileSize ( ulong fileSize ) : string
fileSize ulong
return string
        internal static string FormatFileSize(ulong fileSize)
        {
            if (fileSize < 0)
            {
                throw new ArgumentOutOfRangeException("fileSize");
            }

            if (fileSize >= 0x40000000)
            {
                return string.Format("{0:########0.00} GB", ((double)fileSize) / 1073741824);
            }

            if (fileSize >= 0x100000)
            {
                return string.Format("{0:####0.00} MB", ((double)fileSize) / 1048576);
            }

            if (fileSize >= 0x400)
            {
                return string.Format("{0:####0.00} KB", ((double)fileSize) / 1024);
            }

            return string.Format("{0} bytes", fileSize);
        }