Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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));
     }
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        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();

            }
        }