本文整理汇总了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 );
}
示例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;
}
示例3: Flush
public void Flush()
{
WebHeaderCollection hds = new WebHeaderCollection();
hds.Set( "RTP-Info", "seq=0;rtptime=0" );
ExecRequest( "FLUSH", null, null, hds, true );
}
示例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"]);
}
示例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]);
}
示例6: HttpResponseHeader_Set_Success
public void HttpResponseHeader_Set_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Set(HttpResponseHeader.ProxyAuthenticate, "value123");
Assert.Equal("value123", w[HttpResponseHeader.ProxyAuthenticate]);
}
示例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!
}
}