Consider the following:
I have a text file that has ANSI encoding and I read it into a string in c#
string data = FileSystem.ReadAllText(fn);
I don't do anything to the text except embed it into the drawing as dictionary data in an Xrecord
ResultBuffer rb
= new ResultBuffer
(new TypedValue
(DxfCode
.Text, data
));Xrecord xr
= new Xrecord
();xr.Data = rb;
acDict.SetAt(layout.handle, xr);
acTrans.AddNewlyCreatedDBObject(xr, true);
acTrans.Commit();
This works fine ... however when retrieving it and exporting it to a file it isn't formatted as it is in the source file.
foreach (TypedValue tv in xr.Data)
{
if (tv.TypedCode == DxfCode.Text)
{
data = tv.Value.ToString();
}
}
So one of three things is happening
1) The CR isn't written to the Xrecord;
2) The CR isn't read from the Xrecord;
3) Something else?
To complicate things more, when I read the data into a textbox control, it shows correctly and can be copied and pasted to notepad correctly, but when saved it does not work.
I've investigated the WriteAllText function by opening a file and writing it to a temporary file and it works fine.
I'll entertain ideas ... I could certainly parse the string and replace lf with crlf, but that just feels like a bug waiting to happen