/// <summary>
/// Detects the boundary from the input stream. Assumes that the
/// current position of the reader is the start of the file and therefore
/// the beginning of the boundary.
/// </summary>
/// <param name="reader">
/// The binary reader to parse
/// </param>
/// <returns>
/// The boundary string
/// </returns>
private static string DetectBoundary(RebufferableBinaryReader reader)
{
// Presumably the boundary is --|||||||||||||| where -- is the stuff added on to
// the front as per the protocol and ||||||||||||| is the part we care about.
var boundary = string.Concat(reader.ReadLine().Skip(2));
reader.Buffer("--" + boundary + "\n");
return(boundary);
}