Ejemplo n.º 1
0
 private static void Append(StringBuilder sb, int value, int num_zeroes, bool asFractional)
 {
     if (asFractional)
     {
         GameUtility.AppendAsFractional(sb, value, num_zeroes);
     }
     else
     {
         GameUtility.Append(sb, value, num_zeroes);
     }
 }
Ejemplo n.º 2
0
    public static void Format(StringBuilder sb, string format, params int[] args)
    {
        int  length       = format.Length;
        int  num1         = 0;
        int  num_zeroes1  = 0;
        bool asFractional = false;

        for (int index = 0; index < length; ++index)
        {
            if ((int)format[index] == 48)
            {
                ++num_zeroes1;
            }
            else
            {
                if (num_zeroes1 > 0)
                {
                    GameUtility.Append(sb, args[num1++], num_zeroes1, asFractional);
                    num_zeroes1 = 0;
                }
                asFractional = (int)format[index] == 46 || (int)format[index] == 44;
                sb.Append(format[index]);
            }
        }
        if (num_zeroes1 <= 0)
        {
            return;
        }
        StringBuilder sb1 = sb;

        int[] numArray    = args;
        int   index1      = num1;
        int   num2        = 1;
        int   num3        = index1 + num2;
        int   num4        = numArray[index1];
        int   num_zeroes2 = num_zeroes1;
        int   num5        = asFractional ? 1 : 0;

        GameUtility.Append(sb1, num4, num_zeroes2, num5 != 0);
    }