thats fine or like this
internal static string ResultBufferToString(ResultBuffer buf, bool decompress)
{
if (buf == null)
{
throw new ArgumentNullException("ResultBuffer buffer");
}
System.Text.ASCIIEncoding coder = new System.Text.ASCIIEncoding();
string str = string.Empty;
using (MemoryStream fs = new MemoryStream())
{
using (MemoryStream ms = new MemoryStream())
{
if (decompress)
{
ResultBufferToStream(buf, ms);
Decompress(ms, fs);
}
else
{
ResultBufferToStream(buf, fs);
}
}
str = coder.GetString(fs.GetBuffer());
}
return str.Trim('\0');
}
BTY, I'm not sure what's adding the padding, I would bet it's the resbuf BinaryChunk, if it is, trimming the string is about the only option. goofing with the byte stream might produce unwanted results