public static int MessagePrefixed([NotNull] this IEnumerable <Player> source, [NotNull] string prefix, [NotNull] string message, params object[] formatArgs) { if (source == null) { throw new ArgumentNullException("source"); } if (message == null) { throw new ArgumentNullException("message"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (formatArgs == null) { throw new ArgumentNullException("formatArgs"); } int i = 0; foreach (Packet packet in LineWrapper.WrapPrefixed(prefix, String.Format(message, formatArgs))) { foreach (Player player in source) { player.Send(packet); i++; } } return(i); }
public static int MessagePrefixed([NotNull] this IEnumerable <Player> source, [NotNull] string prefix, [NotNull] string message, [NotNull] params object[] formatArgs) { if (source == null) { throw new ArgumentNullException("source"); } if (message == null) { throw new ArgumentNullException("message"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (formatArgs == null) { throw new ArgumentNullException("formatArgs"); } if (formatArgs.Length > 0) { message = String.Format(message, formatArgs); } Player[] sourceArray = source.ToArray(); foreach (Packet packet in LineWrapper.WrapPrefixed(prefix, message)) { foreach (Player player in sourceArray) { player.Send(packet); } } return(sourceArray.Length); }
/// <summary> Broadcasts a message, prefixing wrapped lines. </summary> /// <param name="source"> List of players who will receive the message. </param> /// <param name="prefix"> Prefix to prepend to prepend to each line after the 1st, /// if any line-wrapping occurs. Does NOT get prepended to first line. </param> /// <param name="message"> String/message to send. </param> /// <returns> Number of players who received the message. </returns> public static int MessagePrefixed([NotNull] this IEnumerable <Player> source, [NotNull] string prefix, [NotNull] string message) { if (source == null) { throw new ArgumentNullException("source"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (message == null) { throw new ArgumentNullException("message"); } int i = 0; Player[] sourceArray = source.ToArray(); foreach (Packet packet in LineWrapper.WrapPrefixed(prefix, message)) { foreach (Player player in sourceArray) { player.Send(packet); i++; } } return(i); }
public void MessagePrefixed([NotNull] string prefix, [NotNull] string message, [NotNull] params object[] formatArgs) { if (prefix == null) { throw new ArgumentNullException("prefix"); } if (message == null) { throw new ArgumentNullException("message"); } if (formatArgs == null) { throw new ArgumentNullException("formatArgs"); } if (formatArgs.Length > 0) { message = String.Format(message, formatArgs); } if (this == Console) { Logger.LogToConsole(message); } else { foreach (Packet p in LineWrapper.WrapPrefixed(prefix, message)) { Send(p); } } }
internal void MessageNowPrefixed([NotNull] string prefix, [NotNull] string message, [NotNull] params object[] args) { if (prefix == null) { throw new ArgumentNullException("prefix"); } if (message == null) { throw new ArgumentNullException("message"); } if (args == null) { throw new ArgumentNullException("args"); } if (IsDeaf) { return; } if (args.Length > 0) { message = String.Format(message, args); } if (this == Console) { Logger.LogToConsole(message); } else { if (Thread.CurrentThread != ioThread) { throw new InvalidOperationException("SendNow may only be called from player's own thread."); } foreach (Packet p in LineWrapper.WrapPrefixed(prefix, message)) { Send(p); } } }
public static int MessagePrefixed([NotNull] this IEnumerable <Player> source, [NotNull] string prefix, [NotNull] string message, params object[] formatArgs) { if (source == null) { throw new ArgumentNullException("source"); } if (message == null) { throw new ArgumentNullException("message"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (formatArgs == null) { throw new ArgumentNullException("formatArgs"); } if (formatArgs.Length > 0) { message = String.Format(message, formatArgs); } int i = 0; Player[] sourceArray = source.ToArray(); foreach (Player player in sourceArray) { foreach (Packet packet in LineWrapper.WrapPrefixed(prefix, message, player.Supports(CpeExt.EmoteFix), player.HasCP437, player.FallbackColors)) { player.Send(packet); i++; } } return(i); }