2014-08-25 19:30:52 -07:00
|
|
|
|
using System.Collections.Generic;
|
2014-04-25 10:30:41 -07:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Dlna.Ssdp
|
|
|
|
|
{
|
|
|
|
|
public class SsdpMessageBuilder
|
|
|
|
|
{
|
|
|
|
|
public string BuildMessage(string header, Dictionary<string, string> values)
|
|
|
|
|
{
|
|
|
|
|
var builder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
const string argFormat = "{0}: {1}\r\n";
|
|
|
|
|
|
|
|
|
|
builder.AppendFormat("{0}\r\n", header);
|
|
|
|
|
|
|
|
|
|
foreach (var pair in values)
|
|
|
|
|
{
|
|
|
|
|
builder.AppendFormat(argFormat, pair.Key, pair.Value);
|
|
|
|
|
}
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2014-04-25 10:30:41 -07:00
|
|
|
|
builder.Append("\r\n");
|
|
|
|
|
|
|
|
|
|
return builder.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|