AA2Install.formLoadModpack.BytesToString C# (CSharp) Method

BytesToString() private method

private BytesToString ( long bytes ) : string
bytes long
return string
        private string BytesToString(long bytes)
        {
            string[] sizes = { "B", "KB", "MB", "GB" };
            double len = bytes;
            int order = 0;
            while (len >= 1024 && order + 1 < sizes.Length)
            {
                order++;
                len = len / 1024;
            }

            return string.Format("{0:0.##} {1}", len, sizes[order]);
        }