コード例 #1
0
 internal bool ResponsePage(ref AutoCSer.Memory.Pointer buffer, ref AutoCSer.Memory.Pointer encodeBuffer)
 {
     if (ResponseStream == null)
     {
         ResponseStream = new UnmanagedStream(default(AutoCSer.Memory.Pointer));
     }
     buffer = UnmanagedPool.Default.GetPointer();
     ResponseStream.Reset(ref buffer);
     using (ResponseStream)
     {
         if (EncodeStream == null)
         {
             EncodeStream = new UnmanagedStream(default(AutoCSer.Memory.Pointer));
         }
         encodeBuffer = UnmanagedPool.Default.GetPointer();
         EncodeStream.Reset(ref encodeBuffer);
         using (EncodeStream)
         {
             Response bodyResponse = new Response {
                 Stream = ResponseStream, EncodeStream = EncodeStream, Encoding = DomainServer.ResponseEncoding
             };
             if (page(ref bodyResponse))
             {
                 HttpResponse.SetBody(ResponseStream);
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #2
0
 internal bool ResponsePage(ref byte *buffer, ref byte *encodeBuffer)
 {
     if (ResponseStream == null)
     {
         ResponseStream = new UnmanagedStream(null, 0);
     }
     ResponseStream.Reset(buffer = AutoCSer.UnmanagedPool.Default.Get(), AutoCSer.UnmanagedPool.DefaultSize);
     using (ResponseStream)
     {
         if (EncodeStream == null)
         {
             EncodeStream = new UnmanagedStream(null, 0);
         }
         EncodeStream.Reset(encodeBuffer = AutoCSer.UnmanagedPool.Default.Get(), AutoCSer.UnmanagedPool.DefaultSize);
         using (EncodeStream)
         {
             Response bodyResponse = new Response {
                 Stream = ResponseStream, EncodeStream = EncodeStream, Encoding = DomainServer.ResponseEncoding
             };
             if (page(ref bodyResponse))
             {
                 HttpResponse.SetBody(ResponseStream);
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #3
0
ファイル: ViewBase.cs プロジェクト: zhangzheng1205/AutoCSer
 internal bool ResponsePage(ref byte *buffer, ref byte *encodeBuffer)
 {
     if (ResponseStream == null)
     {
         ResponseStream = new UnmanagedStream(null, 0);
     }
     ResponseStream.Reset(buffer = AutoCSer.UnmanagedPool.Default.Get(), AutoCSer.UnmanagedPool.DefaultSize);
     using (ResponseStream)
     {
         if (EncodeStream == null)
         {
             EncodeStream = new UnmanagedStream(null, 0);
         }
         EncodeStream.Reset(encodeBuffer = AutoCSer.UnmanagedPool.Default.Get(), AutoCSer.UnmanagedPool.DefaultSize);
         using (EncodeStream)
         {
             Response bodyResponse = new Response {
                 Stream = ResponseStream, EncodeStream = EncodeStream, Encoding = DomainServer.ResponseEncoding
             };
             if (IsAwaitMethod)
             {
                 pageAsync(bodyResponse);
                 AsyncWaitHandle.Wait();
                 if (asyncReturn)
                 {
                     asyncReturn = false;
                     HttpResponse.SetBody(ResponseStream);
                     return(true);
                 }
             }
             else
             {
                 if (page(ref bodyResponse))
                 {
                     HttpResponse.SetBody(ResponseStream);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }