public static string BinaryBreakdown(ulong dataVolume) { DataBreakdown db = Breakdown(dataVolume); StringBuilder sb = new StringBuilder(); if (db.Tebibytes > 0) { sb.AppendFormat("{0} TiB", db.Terabytes); } if (db.Gibibytes > 0) { sb.AppendFormat("{0}{1} GiB", sb.Length > 0 ? ", " : "", db.Gibibytes); } if (db.Mebibytes > 0) { sb.AppendFormat("{0}{1} MiB", sb.Length > 0 ? ", " : "", db.Mebibytes); } if (db.Kibibytes > 0) { sb.AppendFormat("{0}{1} KiB", sb.Length > 0 ? ", " : "", db.Kibibytes); } if (db.BinaryBytes > 0) { sb.AppendFormat("{0}{1} bytes", sb.Length > 0 ? ", " : "", db.BinaryBytes); } return(sb.ToString()); }
public static string DecimalBreakdown(ulong dataVolume) { DataBreakdown db = Breakdown(dataVolume); StringBuilder sb = new StringBuilder(); if (db.Terabytes > 0) { sb.AppendFormat("{0} TB", db.Terabytes); } if (db.Gigabytes > 0) { sb.AppendFormat("{0}{1} GB", sb.Length > 0 ? ", " : "", db.Gigabytes); } if (db.Megabytes > 0) { sb.AppendFormat("{0}{1} MB", sb.Length > 0 ? ", " : "", db.Megabytes); } if (db.Kilobytes > 0) { sb.AppendFormat("{0}{1} KB", sb.Length > 0 ? ", " : "", db.Kilobytes); } if (db.DecimalBytes > 0) { sb.AppendFormat("{0}{1} bytes", sb.Length > 0 ? ", " : "", db.DecimalBytes); } return(sb.ToString()); }