当前位置: 首页>>代码示例>>C#>>正文


C# WebHeaderCollection.Set方法代码示例

本文整理汇总了C#中WebHeaderCollection.Set方法的典型用法代码示例。如果您正苦于以下问题:C# WebHeaderCollection.Set方法的具体用法?C# WebHeaderCollection.Set怎么用?C# WebHeaderCollection.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebHeaderCollection的用法示例。


在下文中一共展示了WebHeaderCollection.Set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Record

    public void Record()
    {
        WebHeaderCollection hds = new WebHeaderCollection();

        if( session == null )
            throw new Exception( "RECORD: no session in progress" );

        hds.Set( "Range", "npt=0-" );
        hds.Set( "RTP-Info", "seq=0;rtptime=0" );

        ExecRequest( "RECORD", null, null, hds, true );
    }
开发者ID:llytvynenko,项目名称:axStream,代码行数:12,代码来源:RTSPClient.cs

示例2: Setup

    public Hashtable Setup()
    {
        Hashtable ht;
        WebHeaderCollection hds = new WebHeaderCollection();

        hds.Set( "Transport",
                 "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record" );
        ht = ExecRequest( "SETUP", null, null, hds, true );

        session = (string)ht[ "Session" ];
        if( session == null )
            throw new Exception( "SETUP: no session in response" );

        string transport = (string)ht[ "Transport" ];
        if( transport == null )
            throw new Exception( "SETUP: no transport in response" );

        string [] ptokens = transport.Split( new char[] { ';' } );
        for( int i = 0; i < ptokens.Length; i++ )
        {
            string [] ctokens = ptokens[ i ].Split( new char [] { '=' } );
            if( ctokens.Length == 2 &&
                ctokens[ 0 ].Equals( "server_port" ) )
            {
                serverport = Convert.ToInt32( ctokens[ 1 ] );
            }
        }

        if( serverport == 0 )
            throw new Exception( "SETUP: no server_port in response" );

        return ht;
    }
开发者ID:llytvynenko,项目名称:axStream,代码行数:33,代码来源:RTSPClient.cs

示例3: Flush

 public void Flush()
 {
     WebHeaderCollection hds = new WebHeaderCollection();
     hds.Set( "RTP-Info", "seq=0;rtptime=0" );
     ExecRequest( "FLUSH", null, null, hds, true );
 }
开发者ID:llytvynenko,项目名称:axStream,代码行数:6,代码来源:RTSPClient.cs

示例4: NameValue_Set_Success

 public void NameValue_Set_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Set("firstName", "first");
     Assert.Equal(1, w.Count);
     Assert.NotEmpty(w);
     Assert.NotEmpty(w.AllKeys);
     Assert.Equal(new[] { "firstName" }, w.AllKeys);
     Assert.Equal("first", w["firstName"]);
 }        
开发者ID:chcosta,项目名称:corefx,代码行数:10,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例5: HttpRequestHeader_Set_Success

        public void HttpRequestHeader_Set_Success()
        {
            WebHeaderCollection w = new WebHeaderCollection();
            w.Set(HttpRequestHeader.Connection, "keep-alive");

            Assert.Equal(1, w.Count);
            Assert.Equal("keep-alive", w[HttpRequestHeader.Connection]);
            Assert.Equal("Connection", w.AllKeys[0]);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例6: HttpResponseHeader_Set_Success

        public void HttpResponseHeader_Set_Success()
        {
            WebHeaderCollection w = new WebHeaderCollection();
            w.Set(HttpResponseHeader.ProxyAuthenticate, "value123");

            Assert.Equal("value123", w[HttpResponseHeader.ProxyAuthenticate]);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:7,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例7: TestWebHeaderCollectionSet

	public void TestWebHeaderCollectionSet()
	{
		WebHeaderCollection whc = new WebHeaderCollection();
		whc.Set("more", "junk");
		try
		{
			whc.Set(null, "value");
			Fail("Set: failed to throw exception for null name");
		}
		catch (ArgumentNullException)
		{
			// Whizzing right along...
		}
		try
		{
			whc.Set("accept", "NoNo");
			Fail("Set: failed to throw exception for restricted header");
		}
		catch (ArgumentException)
		{
			// goodie!
		}
		try
		{
			whc.Set("@this is not right!", "junk");
			Fail("Set: failed to throw exception for invalid header name");
		}
		catch (ArgumentException)
		{
			// Tada!
		}
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:32,代码来源:TestWebHeaderCollection.cs


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