private void AnalyzeComment()
{
Debug.Assert(_mainNode.NodeType == XmlNodeType.Comment);
Debug.Assert((object?)_currentInfo == (object)_mainNode);
StringBuilder?newComment = null;
string comment = _mainNode.Value;
bool minus = false;
int index = 0, begin = 0;
for (; index < comment.Length; index++)
{
switch (comment[index])
{
case s_Minus:
if (minus)
{
if (newComment == null)
{
newComment = new StringBuilder(comment, begin, index, 2 * comment.Length);
}
else
{
newComment.Append(comment, begin, index - begin);
}
newComment.Append(s_SpaceMinus);
begin = index + 1;
}
minus = true;
break;
default:
minus = false;
break;
}
}
if (newComment != null)
{
if (begin < comment.Length)
{
newComment.Append(comment, begin, comment.Length - begin);
}
if (minus)
{
newComment.Append(s_Space);
}
_mainNode.Value = newComment.ToString();
}
else if (minus)
{
_mainNode.ValueAppend(" ", false);
}
}