本文整理汇总了C#中ArgumentList.ParseNone方法的典型用法代码示例。如果您正苦于以下问题:C# ArgumentList.ParseNone方法的具体用法?C# ArgumentList.ParseNone怎么用?C# ArgumentList.ParseNone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgumentList
的用法示例。
在下文中一共展示了ArgumentList.ParseNone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FastForwardTime
/// <summary>
/// Fast forwards time
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void FastForwardTime(ISender sender, ArgumentList args)
{
args.ParseNone();
Core.TimeFastForwarding = !Core.TimeFastForwarding;
sender.Message("Time is now " + (Core.TimeFastForwarding ? "fast" : "normal") + "!");
}
示例2: NPCSpawning
/// <summary>
/// Enables or disables NPC spawning
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void NPCSpawning(ISender sender, ArgumentList args)
{
args.ParseNone();
Core.StopNPCSpawning = !Core.StopNPCSpawning;
sender.Message("NPC spawning is now " + (Core.StopNPCSpawning ? "off" : "on") + "!");
}
示例3: Refresh
/// <summary>
/// Refreshes a players area
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void Refresh(ISender sender, ArgumentList args)
{
args.ParseNone();
var player = sender as Player;
if (player == null)
{
sender.Message(255, "This is a player command");
return;
}
if (player.whoAmI < 0)
return;
if (!player.Op)
{
var diff = DateTime.Now - player.GetLastCostlyCommand();
if (diff < TimeSpan.FromSeconds(30))
{
sender.Message(255, "You must wait {0:0} more seconds before using this command.", 30.0 - diff.TotalSeconds);
return;
}
player.SetLastCostlyCommand(DateTime.Now);
}
NetMessage.SendTileSquare(player.whoAmI, (int)(player.position.X / 16), (int)(player.position.Y / 16), 32);
}
示例4: List
/// <summary>
/// Prints a player list, Possibly readable by bots.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void List(ISender sender, ArgumentList args)
{
args.ParseNone();
var players = from p in Terraria.Main.player
where p.active && !p.IsOp()
select p.name;
var ops = from p in Terraria.Main.player
where p.active && p.IsOp()
select p.name;
var pn = players.Count();
var on = ops.Count();
if (on + pn == 0)
{
sender.Message("No players online.");
return;
}
string ps = String.Empty;
string os = String.Empty;
if (pn > 0)
ps = (on > 0 ? " | Players: " : "Players: ") + String.Join(", ", players);
if (on > 0)
os = "Ops: " + String.Join(", ", ops);
sender.SendMessage(string.Concat(os, ps, " (", on + pn, "/", Netplay.MaxConnections, ")"), 255, 255, 240, 20);
}
示例5: HardMode
/// <summary>
/// Enables hardmode
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void HardMode(ISender sender, ArgumentList args)
{
args.ParseNone();
if (Main.hardMode)
throw new CommandError("Hard mode is already enabled");
sender.Message("Changing to hard mode...");
WorldGen.IsGeneratingHardMode = true;
Terraria.WorldGen.StartHardmode();
while (WorldGen.IsGeneratingHardMode)
System.Threading.Thread.Sleep(5);
sender.Message("Hard mode is now enabled.");
}
示例6: LanguageReload
/// <summary>
/// Reloads the language definitions
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void LanguageReload(ISender sender, ArgumentList args)
{
args.ParseNone();
sender.sendMessage("Reloading Language File...");
sender.sendMessage("Reloading " + (Languages.LoadClass(Collections.Registries.LANGUAGE_FILE) ? "Succeeded" : "Failed"));
}
示例7: OldList
/// <summary>
/// Prints a Playerlist.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public void OldList(ISender sender, ArgumentList args)
{
args.ParseNone();
var online = String.Empty;
if (sender is ConsoleSender)
{
var players = from p in Main.player
where p.active
select String.Format("{0} ({1})", p.name, p.IPAddress);
online = String.Join(", ", players);
}
else
{
var players = from p in Main.player
where p.active
select p.name;
online = String.Join(", ", players);
}
if (String.IsNullOrEmpty(online))
sender.Message("No players online.", 255, 255, 240, 20);
else
sender.Message("Current players: " + online, 255, 255, 240, 20);
}
示例8: QCommand
internal static void QCommand(ISender sender, ArgumentList args)
{
args.ParseNone ();
lock (syncRoot)
{
int c = 1;
for (int q = 3; q >= 0; q--)
{
var queue = queues[q];
if (queue.Count > 0)
{
sender.Message (255, ChatColor.Snow, "Queued with priority {0}:", q);
for (int i = 0; i < queue.count; i++)
{
int k = (queue.head + i) % queue.array.Length;
var conn = queue.array[k];
if (conn != null)
{
sender.Message (255, ChatColor.Beige, " {0}. {1} from {2}", c, conn.Player.Name, conn.RemoteAddress);
c += 1;
}
}
}
}
}
}
示例9: NPCSpawns
/// <summary>
/// Enables or disables NPC spawning
/// </summary>
/// <param name="server">Current Server instance</param>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void NPCSpawns(Server server, ISender sender, ArgumentList args)
{
args.ParseNone();
Main.stopSpawns = !Main.stopSpawns;
sender.sendMessage("NPC Spawning is now " + ((Main.stopSpawns) ? "off" : "on") + "!");
}
示例10: Explosions
public static void Explosions(Server server, ISender sender, ArgumentList args)
{
args.ParseNone();
Program.properties.AllowExplosions = !Program.properties.AllowExplosions;
sender.sendMessage("Explosions are now " + ((Program.properties.AllowExplosions) ? "allowed" : "disabled") + "!");
Program.properties.Save();
}
示例11: Status
/// <summary>
/// Outputs statistics of the servers performance.
/// </summary>
/// <param name="server">Current Server instance</param>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void Status(Server server, ISender sender, ArgumentList args)
{
args.ParseNone();
var process = System.Diagnostics.Process.GetCurrentProcess();
sender.sendMessage(string.Format("Virtual memory: {0:0.0}/{1:0.0}MB",
process.VirtualMemorySize64 / 1024.0 / 1024.0,
process.PeakVirtualMemorySize64 / 1024.0 / 1024.0));
sender.sendMessage(string.Format("Physical memory: {0:0.0}/{1:0.0}MB",
process.WorkingSet64 / 1024.0 / 1024.0,
process.PeakWorkingSet64 / 1024.0 / 1024.0));
var time = process.TotalProcessorTime;
sender.sendMessage(string.Format("Total cpu usage: {0:0.00}% ({1})",
100.0 * time.TotalMilliseconds / (DateTime.Now - process.StartTime).TotalMilliseconds, time));
if (LoadMonitor.LoadLastSecond >= 0)
sender.sendMessage(string.Format("Cpu usage last second: {0:0.00}%", LoadMonitor.LoadLastSecond));
if (LoadMonitor.LoadLastMinute >= 0)
sender.sendMessage(string.Format("Cpu usage last minute: {0:0.00}%", LoadMonitor.LoadLastMinute));
sender.sendMessage(string.Format("Last world update took: {0:0.000}ms (plr: {1:0.0}ms, npc: {2:0.0}ms, proj: {3:0.0}ms, item: {4:0.0}ms, world: {5:0.0}ms, time: {6:0.0}ms, inva: {7:0.0}ms, serv: {8:0.0}ms)",
Program.LastUpdateTime.TotalMilliseconds,
Main.LastPlayerUpdateTime.TotalMilliseconds,
Main.LastNPCUpdateTime.TotalMilliseconds,
Main.LastProjectileUpdateTime.TotalMilliseconds,
Main.LastItemUpdateTime.TotalMilliseconds,
Main.LastWorldUpdateTime.TotalMilliseconds,
Main.LastTimeUpdateTime.TotalMilliseconds,
Main.LastInvasionUpdateTime.TotalMilliseconds,
Main.LastServerUpdateTime.TotalMilliseconds
));
var projs = 0; var uprojs = 0;
var npcs = 0; var unpcs = 0;
var items = 0;
foreach (var npc in Main.npcs)
{
if (!npc.Active) continue;
npcs += 1;
if (!npc.netUpdate) continue;
unpcs += 1;
}
foreach (var proj in Main.projectile)
{
if (!proj.Active) continue;
projs += 1;
if (!proj.netUpdate) continue;
uprojs += 1;
}
foreach (var item in Main.item)
{
if (!item.Active) continue;
items += 1;
}
sender.sendMessage(string.Format("NPCs: {0}a/{1}u, projectiles: {2}a/{3}u, items: {4}", npcs, unpcs, projs, uprojs, items));
#if BANDWIDTH_ANALYSIS
var sb = new System.Text.StringBuilder ();
for (int i = 0; i < 255; i++)
{
var p = Networking.Connection.packetsPerMessage [i];
var b = Networking.Connection.bytesPerMessage [i];
if (p > 0)
sb.AppendFormat ("{0}({1}p, {2}B), ", (Packet)i, p, b);
}
sender.sendMessage (sb.ToString());
#endif
}
示例12: Refresh
/// <summary>
/// Refreshes a players area
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void Refresh(ISender sender, ArgumentList args)
{
args.ParseNone();
var player = sender as Player;
if (player == null)
{
sender.Message(255, Languages.ThisIsPlayerCommand);
return;
}
if (player.whoAmi < 0) return;
if (!player.Op)
{
var diff = DateTime.Now - player.LastCostlyCommand;
if (diff < TimeSpan.FromSeconds(30))
{
sender.Message(255, Languages.YouMustWaitBeforeAnotherCommand, 30.0 - diff.TotalSeconds);
return;
}
player.LastCostlyCommand = DateTime.Now;
}
NetMessage.SendTileSquare(player.whoAmi, (int)(player.Position.X / 16), (int)(player.Position.Y / 16), 32);
}
示例13: RequestsCommand
void RequestsCommand(ISender sender, ArgumentList args)
{
int num;
if (args.TryParseOne ("-g", out num) || args.TryParseOne ("grant", out num))
{
RegistrationRequest rq;
if (! requests.TryGetValue (num, out rq))
{
sender.sendMessage ("restrict.rr: No such registration request");
return;
}
requests.Remove (num);
var pname = NameTransform (rq.name);
var hash = Hash (rq.name, rq.password);
users.setValue (pname, hash);
users.Save ();
var player = FindPlayer (rq.name);
if (player != null) // TODO: verify IP address
{
player.AuthenticatedAs = rq.name;
player.sendMessage ("<Restrict> You are now registered.");
}
Server.notifyOps ("<Restrict> Registration request granted for: " + rq.name, true);
var duplicates = requests.Where (kv => kv.Value.name == rq.name).ToArray();
foreach (var kv in duplicates)
{
// deny other requests for the same name
requests.Remove (kv.Key);
}
}
else if (args.TryParseOne ("-d", out num) || args.TryParseOne ("deny", out num))
{
RegistrationRequest rq;
if (! requests.TryGetValue (num, out rq))
{
sender.sendMessage ("restrict.rr: No such registration request");
return;
}
requests.Remove (num);
Server.notifyOps ("<Restrict> Registration request denied for: " + rq.name, true);
var player = FindPlayer (rq.name);
if (player != null)
player.sendMessage ("<Restrict> Your registration request has been denied.");
}
else
{
args.ParseNone ();
sender.sendMessage ("restrict.rr: Pending requests:");
foreach (var kv in requests)
{
var rq = kv.Value;
if (rq == null) continue;
sender.sendMessage (string.Format ("{0,3} : {1} : {2}", kv.Key, rq.address, rq.name));
}
}
}
示例14: Reload
/// <summary>
/// Reloads Plugins.
/// </summary>
/// <param name="server">Current Server instance</param>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void Reload(Server server, ISender sender, ArgumentList args)
{
args.ParseNone();
server.notifyOps("Reloading plugins.", true);
server.PluginManager.ReloadPlugins();
return;
}
示例15: List
/// <summary>
/// Prints a player list, Possibly readable by bots.
/// </summary>
/// <param name="sender">Sending player</param>
/// <param name="args">Arguments sent with command</param>
public static void List(ISender sender, ArgumentList args)
{
args.ParseNone();
var players = from p in Main.players where p.Active && !p.Op select p.Name;
var ops = from p in Main.players where p.Active && p.Op select p.Name;
var pn = players.Count();
var on = ops.Count();
if (on + pn == 0)
{
sender.sendMessage(Languages.NoPlayers);
return;
}
string ps = "";
string os = "";
if (pn > 0)
ps = (on > 0 ? " | Players: " : "Players: ") + String.Join(", ", players);
if (on > 0)
os = "Ops: " + String.Join(", ", ops);
sender.sendMessage(string.Concat(os, ps, " (", on + pn, "/", SlotManager.MaxSlots, ")"), 255, 255, 240, 20);
}