>>298
ロジック的にかなり無駄があるわけだが

tmp.Split(new char[] { '\n' });
=> tmp.Split(new char[] { '\r', '\n'});

sb.Append("\n");
=> sb.Append("\r\n");