private void BroadcastGame() { var sb = new ExtendedStringBuilder("GAME ", true); sb.Separator = ProgramConstants.LAN_DATA_SEPARATOR; sb.Append(ProgramConstants.LAN_PROTOCOL_REVISION); sb.Append(ProgramConstants.GAME_VERSION); sb.Append(localGame); sb.Append(Map.Name); sb.Append(GameMode.UIName); sb.Append(0); // LoadedGameID var sbPlayers = new StringBuilder(); Players.ForEach(p => sbPlayers.Append(p.Name + ",")); sbPlayers.Remove(sbPlayers.Length - 1, 1); sb.Append(sbPlayers.ToString()); sb.Append(Convert.ToInt32(Locked)); sb.Append(0); // IsLoadedGame GameBroadcast?.Invoke(this, new GameBroadcastEventArgs(sb.ToString())); }
public static string BuildQueryString(Dictionary <string, string> values) { var sb = new ExtendedStringBuilder(); foreach (var kvp in values) { if (sb.Length > 0) { sb += '&'; } sb.Append(kvp.Key).Append('=').Append(kvp.Value); } return(sb); }
public override string ToString() { var sb = new ExtendedStringBuilder() { }; sb.Append(nameof(Url), Url); if (Similarity.HasValue) { sb.Append($"{nameof(Similarity)}", $"{Similarity.Value / 100:P}"); } if (HasImageDimensions) { string?val = $"{Width}x{Height} ({MegapixelResolution:F} MP)"; var resType = DisplayResolution; if (resType != DisplayResolutionType.Unknown) { val += ($" (~{resType})"); } sb.Append($"Resolution", val); } sb.Append(nameof(Name), Name); sb.Append(nameof(Description), Description); sb.Append(nameof(Artist), Artist); sb.Append(nameof(Site), Site); sb.Append(nameof(Source), Source); sb.Append(nameof(Characters), Characters); foreach (var(key, value) in OtherMetadata) { sb.Append(key, value); } sb.Append($"Detail score", $"{DetailScore}/{DetailFields.Count} ({(IsDetailed ? "Y" : "N")})"); return(sb.ToString().RemoveLastOccurrence("\n")); }
public static string BuildQueryString(Dictionary<string, string> values) { var sb = new ExtendedStringBuilder(); foreach (var kvp in values) { if (sb.Length > 0) { sb += '&'; } sb.Append(kvp.Key).Append('=').Append(kvp.Value); } return sb; }