예제 #1
0
        void AppendTextLine(string indentation, IAmbience ambience, int maxLineLength, StringWriter insertedText, string line)
        {
            const int minimumLineLength = 10;
            string    commentedLine;

            while (true)
            {
                commentedLine = ambience.WrapComment(line);
                int commentingOverhead = commentedLine.Length - line.Length;
                if (commentingOverhead < 0 || (maxLineLength - commentingOverhead) < minimumLineLength)
                {
                    break;
                }
                if (commentedLine.Length > maxLineLength)
                {
                    int pos = FindWrapPositionBefore(line, maxLineLength - commentingOverhead);
                    if (pos < minimumLineLength)
                    {
                        break;
                    }
                    insertedText.WriteLine(ambience.WrapComment(line.Substring(0, pos)));
                    insertedText.Write(indentation);
                    line = line.Substring(pos + 1);
                }
                else
                {
                    break;
                }
            }
            insertedText.WriteLine(commentedLine);
            insertedText.Write(indentation);             // indentation for next line
        }
예제 #2
0
		void AppendTextLine(string indentation, IAmbience ambience, int maxLineLength, StringWriter insertedText, string line)
		{
			const int minimumLineLength = 10;
			string commentedLine;
			while (true) {
				commentedLine = ambience.WrapComment(line);
				int commentingOverhead = commentedLine.Length - line.Length;
				if (commentingOverhead < 0 || (maxLineLength - commentingOverhead) < minimumLineLength)
					break;
				if (commentedLine.Length > maxLineLength) {
					int pos = FindWrapPositionBefore(line, maxLineLength - commentingOverhead);
					if (pos < minimumLineLength)
						break;
					insertedText.WriteLine(ambience.WrapComment(line.Substring(0, pos)));
					insertedText.Write(indentation);
					line = line.Substring(pos + 1);
				} else {
					break;
				}
			}
			insertedText.WriteLine(commentedLine);
			insertedText.Write(indentation); // indentation for next line
		}
예제 #3
0
 public string WrapComment(string comment)
 {
     return(conv.WrapComment(comment));
 }