public (int used, int max, int left, float percent) CalcTextSpaceBytesCount(string tableName, int itemIndex) { if (!string.IsNullOrEmpty(tableName)) { var curTable = RomManager.LoadTextGroup(tableName); var curTextItem = curTable.ElementAtOrDefault(itemIndex); int max = 0; int used = 0; float percent; int left; if (curTable is TextTableGroup) { TextTableGroup curGroupCast = (TextTableGroup)curTable; max = curGroupCast.TextGroupInfo.Data.DataMaxSize; used = curGroupCast.DataLength; } else if (curTable is TextArrayGroup) { TextArrayItem curTextItemCast = (TextArrayItem)curTextItem; max = curTextItemCast.ItemInfo.MaxLength; used = curTextItemCast.Data.Length; } if (max > 0) { percent = (float)(used / (double)max); left = max - used; } else { percent = 0; left = max; } return(used, max, left, percent); } return(default);