本文整理汇总了C#中Cache.Report方法的典型用法代码示例。如果您正苦于以下问题:C# Cache.Report方法的具体用法?C# Cache.Report怎么用?C# Cache.Report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache.Report方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Thread
void Thread()
{
// Lazy hard code. API currently broken
// See: https://github.com/vsrz/desbot_vsrz/issues/21
return;
try
{
if (!silent)
{
Program.Log("Retrieving Twitch JSON using API: " + request.RequestUri);
}
using (WebResponse response = request.GetResponse())
{
string title = null;
Cache result = new Cache();
var json = new StreamReader(response.GetResponseStream()).ReadToEnd();
int.TryParse(Parse(json, "viewers"), out result.viewers);
result.embeds = 0;
int.TryParse(Parse(json, "views"), out result.total);
result.stream = Parse(json, "url");
title = Parse(json, "status");
if(result.stream == null) result.stream = stream;
result.retrieved = DateTime.UtcNow;
cache[stream] = result;
if (!silent)
{
result.Report(message);
}
else
{
Program.Log("Viewer statistics: " + result.viewers + " viewers (" + Program.PeakViewers + " peak), " + result.total + " total views, title = " + title);
}
if (stream == DefaultChannel && OnDefaultChannelUpdated != null)
{
OnDefaultChannelUpdated.Invoke(result.viewers != 0 || result.embeds != 0 || result.total != 0, title, result.viewers);
}
}
}
catch (Exception ex)
{
Program.Log("Failed to retrieve viewer count: " + ex.Message);
if (!silent)
{
message.ReplyAuto("The stream " + "" + "appears to be offline");
}
try
{
cache.Remove(stream);
}
finally { }
}
}