本文整理汇总了C#中Quote.GetQuote方法的典型用法代码示例。如果您正苦于以下问题:C# Quote.GetQuote方法的具体用法?C# Quote.GetQuote怎么用?C# Quote.GetQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote.GetQuote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendResponse
public override void SendResponse(int code)
{
string codeStr = code.ToString() + " " + ((HttpStatusCode)code).ToString();
Quote q = new Quote();
string html = "<html>" +
"<body>" +
"<h1>" + codeStr + "</h1>" +
"<h3>Quote of the day</h3>" +
"<blockquote><h3><i>" + q.GetQuote() + "</i></h3></blockquote>" +
"<h3>Черномырдин Виктор Степанович</h3>" +
"</body>" +
"</html>";
ResponseBuilder builder = new PageBuilder()
{
Response = new Response()
{
AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork,
IsConnected = true,
Html = html,
ContentLength = html.Length,
StatusDesc = ((HttpStatusCode)code).ToString(),
ContentType = "text/html",
StatusCode = code,
Charset = System.Text.Encoding.UTF8,
DateTimeResponse = DateTime.Now,
ProtocolType = System.Net.Sockets.ProtocolType.Tcp
}
};
string str = builder.CreateResponse();
// Приведем строку к виду массива байт
byte[] buffer = Encoding.UTF8.GetBytes(str);
// Отправим его клиенту
// this.Client.GetStream().Write(buffer, 0, buffer.Length);
// Закроем соединение
// this.Client.Close();
}