public StudentCommentTimeline() { CrowdCodings = new PostCoding(); CodeBeforeComment = new Dictionary <string, CodeDocument>(); CodeAfterComment = new Dictionary <string, CodeDocument>(); ProgrammingState = new TimelineState(); ProgrammingState.State = "not available"; ExpertCoding = new ContentCoding(); Log = new EventLog(); Author = new OsbideUser(); }
private static Stream GetUnzipStream(ContentCoding contentCoding, Stream httpContentStream) { switch (contentCoding) { case ContentCoding.GZip: return(new GZipStream(httpContentStream, CompressionMode.Decompress)); case ContentCoding.Deflate: return(new DeflateStream(httpContentStream, CompressionMode.Decompress)); default: throw new NotSupportedException(); } }
private static byte[] Unzip(ContentCoding contentCoding, Microsoft.Http.HttpContent httpContent) { if (httpContent == null) { return(null); } if (contentCoding == ContentCoding.Identity) { return(httpContent.ReadAsByteArray()); } using (var zippedStream = GetUnzipStream(contentCoding, httpContent.ReadAsStream())) { return(ReadAllBytes(zippedStream)); } }
private static byte[] Unzip(ContentCoding contentCoding, Microsoft.Http.HttpContent httpContent) { if (httpContent == null) { return null; } if (contentCoding == ContentCoding.Identity) { return httpContent.ReadAsByteArray(); } using (var zippedStream = GetUnzipStream(contentCoding, httpContent.ReadAsStream())) { return ReadAllBytes(zippedStream); } }
private static Stream GetUnzipStream(ContentCoding contentCoding, Stream httpContentStream) { switch (contentCoding) { case ContentCoding.GZip: return new GZipStream(httpContentStream, CompressionMode.Decompress); case ContentCoding.Deflate: return new DeflateStream(httpContentStream, CompressionMode.Decompress); default: throw new NotSupportedException(); } }