Ejemplo n.º 1
0
        private void WriteEntry(FormatObjectProperty entry, int maxNameWidth, int totalWidth)
        {
            bool          nameWritten   = false;
            string        value         = entry.Value;
            StringBuilder line          = new StringBuilder();
            int           spaceForValue = totalWidth - maxNameWidth - 3; // - space for " : "

            while (value != "")
            {
                if (!nameWritten)
                {
                    if (entry.PropertyName.Length > maxNameWidth)
                    {
                        line.Append(entry.PropertyName.Substring(0, maxNameWidth));
                    }
                    else
                    {
                        line.Append(entry.PropertyName.PadRight(maxNameWidth));
                    }
                    line.Append(" : ");
                    nameWritten = true;
                }
                else
                {
                    line.Append("".PadLeft(maxNameWidth + 3)); // + space for " : "
                }
                var len = spaceForValue > value.Length ? value.Length : spaceForValue;
                line.Append(value.Substring(0, len));
                value = value.Substring(len);
                OutputWriter.WriteLine(line.ToString());
                line.Clear();
            }
        }
Ejemplo n.º 2
0
 private void WriteEntry(FormatObjectProperty entry, int maxNameWidth, int totalWidth)
 {
     bool nameWritten = false;
     string value = entry.Value;
     StringBuilder line = new StringBuilder();
     int spaceForValue = totalWidth - maxNameWidth - 3; // - space for " : "
     while (value != "")
     {
         if (!nameWritten)
         {
             if (entry.PropertyName.Length > maxNameWidth)
             {
                 line.Append(entry.PropertyName.Substring(0, maxNameWidth));
             }
             else
             {
                 line.Append(entry.PropertyName.PadRight(maxNameWidth));
             }
             line.Append(" : ");
             nameWritten = true;
         }
         else
         {
             line.Append("".PadLeft(maxNameWidth + 3)); // + space for " : "
         }
         var len = spaceForValue > value.Length ? value.Length : spaceForValue;
         line.Append(value.Substring(0, len));
         value = value.Substring(len);
         OutputWriter.WriteLine(line.ToString());
         line.Clear();
     }
 }