本文整理汇总了C#中WebRequest.WriteOut方法的典型用法代码示例。如果您正苦于以下问题:C# WebRequest.WriteOut方法的具体用法?C# WebRequest.WriteOut怎么用?C# WebRequest.WriteOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebRequest
的用法示例。
在下文中一共展示了WebRequest.WriteOut方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public override void ProcessRequest(WebRequest request)
{
System.IO.FileInfo info = null;
if (!String.IsNullOrEmpty(Terraria.Main.worldPathName))
{
info = new System.IO.FileInfo(Terraria.Main.worldPathName);
}
request.Writer.Buffer(Terraria.Main.worldName ?? String.Empty);
request.Writer.Buffer(Terraria.Main.maxTilesX);
request.Writer.Buffer(Terraria.Main.maxTilesY);
if (info != null && info.Exists)
{
request.Writer.Buffer(info.Length);
}
else
{
request.Writer.Buffer(0L);
}
request.Writer.Buffer(Heartbeat.Enabled);
request.Writer.Buffer(Heartbeat.ServerName);
request.Writer.Buffer(Heartbeat.ServerDescription);
request.Writer.Buffer(Heartbeat.ServerDomain);
request.Writer.Buffer(Heartbeat.PublishToList);
request.WriteOut();
}
示例2: ProcessRequest
//TODO simple JSON writer
//struct Info
//{
// public string Provider { get; set; }
//}
public override void ProcessRequest(WebRequest request)
{
//We don't need a list here, but I rather get away from the lock quicker.
var dependencies = new System.Collections.Generic.List<ResourceDependancy>();
WebServer.ForEachPage((page) =>
{
var dpd = page.GetDependencies();
if (dpd != null)
{
dependencies.AddRange(dpd);
}
});
//Since we are using a list we can make it a bit easier
request.Writer.Buffer(dependencies.Count);
foreach (var item in dependencies)
{
request.Writer.Buffer((byte)item.Type);
request.Writer.Buffer(item.Url);
}
dependencies.Clear();
dependencies = null;
request.WriteOut("application/octet-stream");
}
示例3: ProcessRequest
//TODO simple JSON writer
//struct Info
//{
// public string Provider { get; set; }
//}
public override void ProcessRequest(WebRequest request)
{
request.StatusCode = 200;
//TODO buffer responses in order to fill the Content-Length header
//var length = (WebServer.ProviderName.Length + 4) + 4 + 4;
//request.RepsondHeader(200, "OK", "application/octet-stream", length);
//request.Send(WebServer.ProviderName);
//request.Send(Globals.Build);
//request.Send(Entry.CoreBuild);
//request.End();
request.Writer.Buffer(WebServer.ProviderName);
request.Writer.Buffer(Globals.Build);
request.Writer.Buffer(Entry.CoreBuild);
request.WriteOut("application/octet-stream");
}
示例4: ProcessRequest
//static System.Diagnostics.PerformanceCounter _memCounter;
public override void ProcessRequest(WebRequest request)
{
CheckTimer();
request.StatusCode = 200;
if (_info != null)
{
request.Writer.Buffer(true);
var it = _info.Value;
//Max Memory
//request.Writer.Buffer(_memCounter.RawValue / 1024.0 / 1024.0);
request.Writer.Buffer(it.CPU);
request.Writer.Buffer(it.CPUTimeMs);
request.Writer.Buffer(ResourceMonitor.CPUAverage);
request.Writer.Buffer(ResourceMonitor.CPUMax);
request.Writer.Buffer(8.0 * 1024.0 * 1024.0 * 1024.0);
request.Writer.Buffer(it.Virtual);
request.Writer.Buffer(it.VirtualMax);
request.Writer.Buffer(ResourceMonitor.VirtualAverage);
request.Writer.Buffer(it.Working);
request.Writer.Buffer(it.WorkingMax);
request.Writer.Buffer(ResourceMonitor.WorkingAverage);
request.Writer.Buffer(tdsm.api.Tools.ActivePlayerCount);
request.Writer.Buffer(Main.maxNetPlayers);
//Server is running
request.Writer.Buffer(Netplay.ServerUp);
request.Writer.Buffer(ServerCore.Server.AcceptNewConnections);
//System.Diagnostics.Debug.WriteLine("it.CPU: " + it.CPU);
//System.Diagnostics.Debug.WriteLine("it.Virtual: " + it.Virtual);
//System.Diagnostics.Debug.WriteLine("it.Working: " + it.Working);
}
else
{
request.Writer.Buffer(false);
}
request.WriteOut();
}