long pos = stream.Position;