示例#1
0
        public string Format()
        {
            if (Data.Length == 0)
            {
                return("\n=========== Profile empty ============\n");
            }

            var result = "";

            for (; Index < Data.Length && Index != Count && Sum <= SumMax; Index++)
            {
                var item = Data[Index];
                result += item.Format(Index.ToString());
                Sum    += item.Duration;
            }

            var stringAligner = new StringAligner();

            stringAligner.AddFloatingColumn("#");
            stringAligner.AddFloatingColumn("  ");
            stringAligner.AddFloatingColumn("  ");
            stringAligner.AddFloatingColumn("  ");

            result  = "\n=========== Profile ==================\n" + stringAligner.Format(result);
            result += "Total:\t" + SumAll.Format3Digits();
            if (Index < Data.Length)
            {
                result +=
                    " (" + (Data.Length - Index) + " not-shown-items " + (SumAll - Sum).Format3Digits() + ")";
            }
            result += "\n======================================\n";
            return(result);
        }
示例#2
0
    /// <summary>
    ///     Provide default string aligner with columnCount columns
    /// </summary>
    /// <param name="columnCount"></param>
    /// <returns></returns>
    public static StringAligner StringAligner(this int columnCount)
    {
        var stringAligner = new StringAligner();

        for (var i = 0; i < columnCount; i++)
        {
            stringAligner.AddFloatingColumn("  ");
        }
        return(stringAligner);
    }
示例#3
0
            public string Format()
            {
                if (_data.Length == 0)
                {
                    return("\n=========== Profile empty ============\n");
                }

                var result = "";

                for (; _index < _data.Length && _index != _count && _sum <= _sumMax; _index++)
                {
                    var item = _data[_index];
                    result += item.Format(_index.ToString());
                    _sum   += item.Duration;
                }

                var stringAligner = new StringAligner();

                stringAligner.AddFloatingColumn("#");
                stringAligner.AddFloatingColumn("  ");
                stringAligner.AddFloatingColumn("  ");
                stringAligner.AddFloatingColumn("  ");

                result  = "\n=========== Profile ==================\n" + stringAligner.Format(result);
                result += "Total:\t" + _sumAll.Format3Digits();
                if (_index < _data.Length)
                {
                    result +=
                        " ("
                        + (_data.Length - _index)
                        + " not-shown-items "
                        + (_sumAll - _sum).Format3Digits()
                        + ")";
                }
                result += "\n======================================\n";
                return(result);
            }