本文整理汇总了C#中ApiClient.SetGameList方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.SetGameList方法的具体用法?C# ApiClient.SetGameList怎么用?C# ApiClient.SetGameList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.SetGameList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateWebsiteTimerOnElapsed
private void UpdateWebsiteTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
{
lock (UpdateWebsiteTimer)
{
if (ticking)
return;
ticking = true;
}
try
{
var client = new ApiClient();
var list = new List<GameDetails>();
var games = Games.ToArray();
foreach (var g in games)
{
var gd = new GameDetails()
{
AllowsSpectators = g.Spectator,
Id = g.Id,
GameId = g.GameGuid,
GameName = g.GameName,
Host = g.Username,
Name = g.Name,
InProgress = g.GameStatus == EHostedGame.GameInProgress,
PasswordProtected = g.HasPassword,
DateCreated = g.TimeStarted,
GameVersion = g.GameVersion,
GameIconUrl = g.GameIconUrl,
HostIconUrl = g.UserIconUrl,
IpAddress = g.IpAddress.ToString(),
Port = g.Port
};
list.Add(gd);
}
if (client.SetGameList(AppConfig.Instance.ApiKey, list) == false)
{
Log.Warn("UpdateWebsiteTimerOnElapsed: Couldn't set the game list, some kinda error.");
}
}
catch (Exception e)
{
Log.Error("UpdateWebsiteTimerOnElapsedError", e);
throw;
}
finally
{
ticking = false;
}
}