imported signalr 1.1.3 into NzbDrone.

This commit is contained in:
kayone
2013-11-21 21:26:57 -08:00
parent 891443e05d
commit 0e623e7ce4
236 changed files with 20490 additions and 35 deletions
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
using System;
using System.IO;
using System.Text;
namespace Microsoft.AspNet.SignalR.Infrastructure
{
public class ArraySegmentTextReader : TextReader
{
private readonly ArraySegment<byte> _buffer;
private readonly Encoding _encoding;
private int _offset;
public ArraySegmentTextReader(ArraySegment<byte> buffer, Encoding encoding)
{
_buffer = buffer;
_encoding = encoding;
_offset = _buffer.Offset;
}
public override int Read(char[] buffer, int index, int count)
{
int bytesCount = _encoding.GetByteCount(buffer, index, count);
int bytesToRead = Math.Min(_buffer.Count - _offset, bytesCount);
int read = _encoding.GetChars(_buffer.Array, _offset, bytesToRead, buffer, index);
_offset += bytesToRead;
return read;
}
}
}