using System.Collections; using System.Collections.Generic; using UnityEngine; namespace YKMoon.IO { public enum EFileLocation { Normal, Resources, StreamingAsset, } public partial class IOTools { public static string GetSizeString(ulong length) { var sb = StringBuilderPool.Get(); float result; if(length >= 1073741824) { result = length / 1073741824.00F; sb.AppendFormat("{0:F2}GB", result); } else if(length >= 1048576) { result = length / 1048576.00F; sb.AppendFormat("{0:F2}MB", result); } else { result = length / 1024.00F; sb.AppendFormat("{0:F2}KB", result); } string resultStr = sb.ToString(); StringBuilderPool.Release(sb); return resultStr; } } }