您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
951 B
33 行
951 B
using System;
|
|
using System.Text;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
static class StringBuilderExtensions
|
|
{
|
|
public static void AppendIndentedLines(this StringBuilder sb, string lines, string indentation)
|
|
{
|
|
sb.EnsureCapacity(sb.Length + lines.Length);
|
|
var charIndex = 0;
|
|
while (charIndex < lines.Length)
|
|
{
|
|
var nextNewLineIndex = lines.IndexOf(Environment.NewLine, charIndex, StringComparison.Ordinal);
|
|
if (nextNewLineIndex == -1)
|
|
{
|
|
nextNewLineIndex = lines.Length;
|
|
}
|
|
|
|
sb.Append(indentation);
|
|
|
|
for (var i = charIndex; i < nextNewLineIndex; i++)
|
|
{
|
|
sb.Append(lines[i]);
|
|
}
|
|
|
|
sb.AppendLine();
|
|
|
|
charIndex = nextNewLineIndex + Environment.NewLine.Length;
|
|
}
|
|
}
|
|
}
|
|
}
|