本文整理汇总了C#中ArgumentList.GetBool方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentList.GetBool方法的具体用法?C# ArgumentList.GetBool怎么用?C# ArgumentList.GetBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentList
的用法示例。
在下文中一共展示了ArgumentList.GetBool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServerList
/// <summary>
/// Manages the server list
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void ServerList(ISender sender, ArgumentList args)
{
string first;
args.TryPopOne(out first);
switch (first)
{
case "enable":
Heartbeat.Begin(CoreBuild);
sender.SendMessage("Heartbeat enabled to the TDSM server.");
break;
case "disable":
Heartbeat.End();
sender.SendMessage("Heartbeat disabled to the TDSM server.");
break;
case "public":
Heartbeat.PublishToList = args.GetBool(1);
sender.SendMessage("Server list is now " + (Heartbeat.PublishToList ? "public" : "private"));
break;
case "desc":
string d;
if (args.TryPopOne(out d))
{
Heartbeat.ServerDescription = d;
sender.SendMessage("Description set to: " + Heartbeat.ServerDescription);
}
else sender.SendMessage("Current description: " + Heartbeat.ServerDescription);
break;
case "name":
string n;
if (args.TryPopOne(out n))
{
Heartbeat.ServerName = n;
sender.SendMessage("Name set to: " + Heartbeat.ServerName);
}
else sender.SendMessage("Current name: " + Heartbeat.ServerName);
break;
case "domain":
string h;
if (args.TryPopOne(out h))
{
Heartbeat.ServerDomain = h;
sender.SendMessage("Domain set to: " + Heartbeat.ServerDomain);
}
else sender.SendMessage("Current domain: " + Heartbeat.ServerDomain);
break;
case "?":
case "print":
sender.SendMessage("Heartbeat is " + (Heartbeat.Enabled ? "enabled" : "disabled"));
sender.SendMessage("Server list " + (Heartbeat.PublishToList ? "public" : "private"));
sender.SendMessage("Current name: " + Heartbeat.ServerName);
sender.SendMessage("Current domain: " + Heartbeat.ServerDomain);
sender.SendMessage("Current description: " + Heartbeat.ServerDescription);
break;
default:
throw new CommandError("Not a supported serverlist command " + first);
}
}
示例2: ServerList
/// <summary>
/// Manages the server list
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void ServerList(ISender sender, ArgumentList args)
{
string first;
args.TryPopOne(out first);
switch (first)
{
case "enable":
if (!Heartbeat.Enabled)
{
Heartbeat.Begin(Entry.CoreBuild);
sender.SendMessage("Heartbeat enabled to the TDSM server.");
}
else
{
sender.SendMessage("Heartbeat is already enabled.");
}
break;
case "disable":
if (Heartbeat.Enabled)
{
Heartbeat.End();
sender.SendMessage("Heartbeat disabled to the TDSM server.");
}
else
{
sender.SendMessage("Heartbeat is not enabled.");
}
break;
case "public":
Heartbeat.PublishToList = args.GetBool(0);
if (!ConfigUpdater.IsAvailable || ConfigUpdater.Set("server-list", Heartbeat.PublishToList))
sender.SendMessage("Server list is now " + (Heartbeat.PublishToList ? "public" : "private"));
else sender.Message("Failed to update visibility");
break;
case "desc":
string d;
if (args.TryPopOne(out d))
{
Heartbeat.ServerDescription = d;
if (!ConfigUpdater.IsAvailable || ConfigUpdater.Set("server-list-desc", d))
sender.SendMessage("Description set to: " + Heartbeat.ServerDescription);
else sender.Message("Failed to update description");
}
else
sender.SendMessage("Current description: " + Heartbeat.ServerDescription);
break;
case "name":
string n;
if (args.TryPopOne(out n))
{
Heartbeat.ServerName = n;
if (!ConfigUpdater.IsAvailable || ConfigUpdater.Set("server-list-name", n))
sender.SendMessage("Name set to: " + Heartbeat.ServerName);
else sender.Message("Failed to update name");
}
else
sender.SendMessage("Current name: " + Heartbeat.ServerName);
break;
case "domain":
string h;
if (args.TryPopOne(out h))
{
Heartbeat.ServerDomain = h;
if (!ConfigUpdater.IsAvailable || ConfigUpdater.Set("server-list-domain", h))
sender.SendMessage("Domain set to: " + Heartbeat.ServerDomain);
else sender.Message("Failed to update domain");
}
else
sender.SendMessage("Current domain: " + Heartbeat.ServerDomain);
break;
case "?":
case "print":
sender.SendMessage("Heartbeat is " + (Heartbeat.Enabled ? "enabled" : "disabled"));
if (Heartbeat.LastBeat.HasValue)
sender.SendMessage("Last beat: " + Heartbeat.LastBeat);
else
sender.SendMessage("Last beat: n/a");
sender.SendMessage("Server list is " + (Heartbeat.PublishToList ? "public" : "private"));
sender.SendMessage("Current name: " + Heartbeat.ServerName);
sender.SendMessage("Current domain: " + Heartbeat.ServerDomain);
sender.SendMessage("Current description: " + Heartbeat.ServerDescription);
break;
default:
throw new CommandError("Not a supported serverlist command " + first);
}
}