• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ReadState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ReadState的典型用法代码示例。如果您正苦于以下问题:C# ReadState类的具体用法?C# ReadState怎么用?C# ReadState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReadState类属于命名空间,在下文中一共展示了ReadState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Connection

 internal Connection(System.Net.ConnectionGroup connectionGroup) : base(null)
 {
     this.m_IISVersion = -1;
     this.m_Free = true;
     this.m_Idle = true;
     this.m_KeepAlive = true;
     this.m_MaximumUnauthorizedUploadLength = SettingsSectionInternal.Section.MaximumUnauthorizedUploadLength;
     if (this.m_MaximumUnauthorizedUploadLength > 0L)
     {
         this.m_MaximumUnauthorizedUploadLength *= 0x400L;
     }
     this.m_ResponseData = new CoreResponseData();
     this.m_ConnectionGroup = connectionGroup;
     this.m_ReadBuffer = new byte[0x1000];
     this.m_ReadState = ReadState.Start;
     this.m_WaitList = new List<WaitListItem>();
     this.m_WriteList = new ArrayList();
     this.m_AbortDelegate = new HttpAbortDelegate(this.AbortOrDisassociate);
     this.m_ConnectionUnlock = new UnlockConnectionDelegate(this.UnlockRequest);
     this.m_StatusLineValues = new StatusLineValues();
     this.m_RecycleTimer = this.ConnectionGroup.ServicePoint.ConnectionLeaseTimerQueue.CreateTimer();
     this.ConnectionGroup.Associate(this);
     this.m_ReadDone = true;
     this.m_WriteDone = true;
     this.m_Error = WebExceptionStatus.Success;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:Connection.cs


示例2: ReadComplete

		void ReadComplete( IAsyncResult iar )
		{
			int toread = 4;
			int bytes = 0;
			try
			{
				bytes = socket.EndReceive( iar );
			}
			catch( Exception )
			{
				socket.Close();
				disconnected = true;
				return;
			}
			switch( state )
			{
			case ReadState.readLength:
				toread = BitConverter.ToInt32( buffer.GetBuffer(), 0 );
				state = ReadState.readData;
				break;
			case ReadState.readData:
				state = ReadState.readLength;
				Protocol.Message msgId = (Protocol.Message)BitConverter.ToInt32( buffer.GetBuffer(), 0 );
				switch( msgId )
				{
				default:
					Log.log( "Received unhandled message: {0}", msgId );
					break;
					//case Protocol.Message.
				}
				break;
			}
			buffer.SetLength( toread );
			socket.BeginReceive( buffer.GetBuffer(), 0, toread, SocketFlags.None, ReadComplete, null );
		}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:35,代码来源:ClientConnection.cs


示例3: BeginRead

 internal void BeginRead()
 {
     NetworkStream netstream = _tcp.GetStream();
     int bufferSize = _tcp.ReceiveBufferSize;
     var state = new ReadState(netstream, bufferSize);
     netstream.BeginRead(state.Buffer, 0, state.Buffer.Length, ReadCallback, state);
 }
开发者ID:blesh,项目名称:ALE,代码行数:7,代码来源:WebSocket.cs


示例4: Poll

 public void Poll()
 {
     while (_stream.DataAvailable) {
         switch (_readState) {
         case ReadState.ReadLength:
             _bufInt32Offset += _stream.Read(_bufInt32, _bufInt32Offset, 4 - _bufInt32Offset);
             if (_bufInt32Offset == 4) {
                 _readState = ReadState.ReadType;
                 _bufInt32Offset = 0;
                 _intConverter.FromBytes(_bufInt32, 0);
                 _payload = new byte[_intConverter.intdata];
             }
             break;
         case ReadState.ReadType:
             _bufInt32Offset += _stream.Read (_bufInt32, _bufInt32Offset, 4 - _bufInt32Offset);
             if (_bufInt32Offset == 4) {
                 _readState = ReadState.ReadPayload;
                 _bufInt32Offset = 0;
                 _intConverter.FromBytes(_bufInt32, 0);
                 _type = (PacketType)_intConverter.intdata;
             }
             break;
         case ReadState.ReadPayload:
             _payloadOffset += _stream.Read(_payload, _payloadOffset, _payload.Length - _payloadOffset);
             if (_payloadOffset == _payload.Length) {
                 _readState = ReadState.ReadLength;
                 _payloadOffset = 0;
                 if (OnResponse != null) {
                     OnResponse(new Packet(){ type = _type, payload = _payload });
                 }
             }
             break;
         }
     }
 }
开发者ID:nobnak,项目名称:TestPTP,代码行数:35,代码来源:PTPIPStream.cs


示例5: CommState

			internal CommState()
			{
				idle_tick = new Timer( CheckIdle, null, 30000, 30000 );
				readstate = ReadState.getLength;
				buffer = new MemoryStream( 1024 );
				send_buffer = new MemoryStream( 1024 );
			}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:7,代码来源:RegistryServer.cs


示例6: ChunkParser

 public ChunkParser(Connection connection,ArraySegment<byte> initialBuffer, int initialBufferOffset, int initialBufferCount)
 {
     _connection = connection;
     _buffer = initialBuffer;
     _bufferCurrentPos = initialBufferOffset;
     _bufferSize = initialBufferOffset + initialBufferCount;
     _readState = ReadState.ChunkLength;
     _currentChunkLength = -1;
 }
开发者ID:llenroc,项目名称:HttpClient,代码行数:9,代码来源:ChunkParser.cs


示例7: Get

 public RilList Get(ReadState state, DateTime? since, int? count, int? page, bool myAppOnly, bool tags)
 {
     var list = new RilList();
     list.Items = new Dictionary<string, RilListItem>();
     list.Items.Add("12345", new RilListItem() { Title = "Website 1", Url = "www.web1.com" });
     list.Items.Add("23456", new RilListItem() { Title = "Website 2", Url = "www.web2.com" });
     list.Items.Add("34567", new RilListItem() { Title = "Website 3", Url = "www.web3.com", Tags = "existing-tag" });
     return list;
 }
开发者ID:kareem613,项目名称:auto-tagger,代码行数:9,代码来源:MockRilClient.cs


示例8: MasterServerConnection

			internal MasterServerConnection( TcpClient client)
			{
				this.tcpClient = client;
				socket = client.Client;
				state = ReadState.readLength;
				socket.NoDelay = true;
				buffer.SetLength( 4 ); // makes ure buffer has a buffer
				socket.BeginReceive( buffer.GetBuffer(), 0, 4, SocketFlags.None, ReadComplete, client );
				SendHello();
			}
开发者ID:d3x0r,项目名称:Voxelarium,代码行数:10,代码来源:MasterServerConnector.cs


示例9: TextIncludingReader

		public TextIncludingReader(Uri includeLocation, string encoding,
			string accept, string acceptLanguage, bool exposeCDATA) {
			_includeLocation = includeLocation;			
			_href = includeLocation.AbsoluteUri;
			_encoding = encoding;
			_state = ReadState.Initial;
			_accept = accept;			
			_acceptLanguage = acceptLanguage;
            _exposeCDATA = exposeCDATA;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:10,代码来源:TextIncludingReader.cs


示例10: ResetForNewResponse

        private void ResetForNewResponse()
        {
            if (_errorDecoder != null)
            {
            	_errorDecoder.Dispose();
                _errorDecoder = null;
            }

            _readState = new ReadState();
            _currentReadState = ReadResponseHeader;
        }
开发者ID:akutruff,项目名称:Couchbase.Net,代码行数:11,代码来源:ResponseStreamReader.cs


示例11: Read

        internal static string Read(Record record, int lengthBits, ref int continueIndex, ref ushort offset)
        {
            string text = string.Empty;

            ReadState state = new ReadState(record, lengthBits, continueIndex, offset);
            Read(state);
            continueIndex = state.ContinueIndex;
            offset = state.Offset;

            return new string(state.CharactersRead.ToArray());
        }
开发者ID:shi5588,项目名称:shi5588,代码行数:11,代码来源:UnicodeBytes.cs


示例12: Create

 public static IHandler Create(WebSocketHttpRequest request, Action<string> onMessage, Action onClose)
 {
     var readState = new ReadState();
     return new ComposableHandler
     {
         Handshake = () => Hybi13Handler.BuildHandshake(request),
         Frame = s => Hybi13Handler.FrameData(Encoding.UTF8.GetBytes(s), FrameType.Text),
         Close = i => Hybi13Handler.FrameData(i.ToBigEndianBytes<ushort>(), FrameType.Close),
         RecieveData = d => Hybi13Handler.ReceiveData(d, readState, (op, data) => Hybi13Handler.ProcessFrame(op, data, onMessage, onClose))
     };
 }
开发者ID:smerrell,项目名称:Fleck,代码行数:11,代码来源:Hybi13Handler.cs


示例13: Create

 public static IHandler Create(WebSocketHttpRequest request, Action<string> onMessage, Fleck2Extensions.Action onClose, Action<byte[]> onBinary)
 {
     var readState = new ReadState();
     return new ComposableHandler
     {
         Handshake = () => BuildHandshake(request),
         TextFrame = data => FrameData(Encoding.UTF8.GetBytes(data), FrameType.Text),
         BinaryFrame = data => FrameData(data, FrameType.Binary),
         CloseFrame = i => FrameData(i.ToBigEndianBytes<ushort>(), FrameType.Close),
         ReceiveData = bytes => ReceiveData(bytes, readState, (op, data) => ProcessFrame(op, data, onMessage, onClose, onBinary))
     };
 }
开发者ID:peters,项目名称:Fleck2,代码行数:12,代码来源:Hybi13Handler.cs


示例14: BufferEnd

 private bool BufferEnd()
 {
     if (this.maxOffset != 0)
     {
         return false;
     }
     if ((this.readState != ReadState.ReadWS) && (this.readState != ReadState.ReadValue))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new FormatException(System.Runtime.Serialization.SR.GetString("MimeReaderMalformedHeader")));
     }
     this.readState = ReadState.EOF;
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:MimeHeaderReader.cs


示例15: XmlMicrodataReader

 public XmlMicrodataReader(HtmlAgilityPack.HtmlNode rootEntity)
 {
     this.readState = System.Xml.ReadState.Initial;
     this.rootEntity = new Item(rootEntity);
     this.nodeType = XmlNodeType.None;
     var typeAttr = rootEntity.GetAttributeItemType();
     if (typeAttr != null)
     {
         Uri type;
         Uri.TryCreate(typeAttr.Value, UriKind.Absolute, out type);
         this.Type = type;
     }
 }
开发者ID:joshcodes,项目名称:JoshCodes.Web,代码行数:13,代码来源:XmlMicrodataReader.cs


示例16: Read

		public override bool Read()
		{
			switch (readState) {
				case ReadState.Initial:
					readState = ReadState.Interactive;
					return ReadCurrentPosition();
				case ReadState.Interactive:
					objectIterator.MoveInto();
					return ReadCurrentPosition();
				default:
					return false;
			}
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:13,代码来源:AXmlReader.cs


示例17: Create

 public static IHandler Create(WebSocketHttpRequest request, Action<string> onMessage, Action onClose, Action<byte[]> onBinary, Action<byte[]> onPing, Action<byte[]> onPong)
 {
     var readState = new ReadState();
     return new ComposableHandler
     {
         Handshake = sub => Hybi13Handler.BuildHandshake(request, sub),
         TextFrame = s => Hybi13Handler.FrameData(Encoding.UTF8.GetBytes(s), FrameType.Text),
         BinaryFrame = s => Hybi13Handler.FrameData(s, FrameType.Binary),
         PingFrame = s => Hybi13Handler.FrameData(s, FrameType.Ping),
         PongFrame = s => Hybi13Handler.FrameData(s, FrameType.Pong),
         CloseFrame = i => Hybi13Handler.FrameData(i.ToBigEndianBytes<ushort>(), FrameType.Close),
         ReceiveData = d => Hybi13Handler.ReceiveData(d, readState, (op, data) => Hybi13Handler.ProcessFrame(op, data, onMessage, onClose, onBinary, onPing, onPong))
     };
 }
开发者ID:vishnumitraha,项目名称:seb-win,代码行数:14,代码来源:Hybi13Handler.cs


示例18: BeginRead

 private static void BeginRead(ReadState rs, Action callback)
 {
     AsyncCallback asyncCallback = ar => {
                                   	int count = rs.Stream.EndRead(ar);
                                   	rs.Offset += count;
                                   	rs.Count -= count;
                                   	if(rs.Count > 0) {
                                   		BeginRead(rs, callback);
                                   	}
                                   	else {
                                   		callback();
                                   	}
                                   };
     rs.Stream.BeginRead(rs.Buffer, rs.Offset, rs.Count, asyncCallback, rs);
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:15,代码来源:AsyncStreamExtensions.cs


示例19: Read

		/// <summary>
		/// See <see cref="XmlReader.Read"/>.
		/// </summary>
		public override bool Read()
		{
			if (state == ReadState.Initial)
			{
				state = ReadState.Interactive;
				isRoot = true;
				nodeType = XmlNodeType.Element;
				return true;
			}
			else if (state == ReadState.EndOfFile)
			{
				return false;
			}

			bool read = base.Read();

			if (isRoot)
			{
				if (!read)
				{
					isRoot = false;
					nodeType = XmlNodeType.None;
					state = ReadState.EndOfFile;
				}
				else
				{
					isRoot = false;
				}
			}
			else
			{
				if (!read)
				{
					isRoot = true;
					nodeType = XmlNodeType.EndElement;
					return true;
				}
			}

			return read;
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:44,代码来源:XmlFragmentReader.cs


示例20: ReadNewLine

        private void ReadNewLine(byte[] buffer, int startIndex, int lastIndex, bool beforeContentDisposition)
        {
            _readState = beforeContentDisposition ? ReadState.ReadBeforeContentDisposition : ReadState.ReadAfterContentDisposition;

            for (int i = startIndex; i < lastIndex; ++i)
            {
                if (!beforeContentDisposition)
                {
                    _contentDisposition.Add(buffer[i]);
                }

                if (buffer[i] == _newLine[_newLineIndex])
                {
                    _newLineIndex++;
                    if (_newLineIndex == 2)
                    {
                        _newLineIndex = 0;

                        if (beforeContentDisposition)
                        {
                            // found a new line character here. now start parsing the content-disposition 
                            _contentDisposition.Clear();
                            ReadNewLine(buffer, i + 1, lastIndex, false);
                        }
                        else
                        {
                            // reach the end of content-disposition. extract the filename out of it
                            _currentFileName = ParseContentDisposition(_contentDisposition.ToArray());
                            SearchForBoundary(buffer, i + 1, lastIndex);
                        }

                        return;
                    }
                }
                else
                {
                    _newLineIndex = 0;
                }
            }
        }
开发者ID:henrycomein,项目名称:NuGetGallery,代码行数:40,代码来源:AsyncFileUploadRequestParser.cs



注:本文中的ReadState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReadStyle类代码示例发布时间:2022-05-24
下一篇:
C# ReadPreference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap