/// <summary> /// Converts a NameValueCollection into a human readable string representation /// </summary> /// <param name="nvc">The NameValueCollection</param> /// <param name="name">The name of the collection</param> /// <param name="hideKeys">If there is any values that need to be hidden</param> /// <returns>Human readable string</returns> public static string AsString(this NameValueCollection nvc, string name = null, CaseInsensitiveBinaryList <string> hideKeys = null) => SafeTry.IgnoreException(() => { var sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(name)) { sb.Append(name); sb.AppendLine(": "); } if (nvc?.IsDefault() ?? true) { return(sb.ToString()); } if (hideKeys == null) { hideKeys = new List <string>().ToCaseInsensitiveBinaryList(); } foreach (var key in nvc.AllKeys) { sb.Append(key); sb.Append(" = "); if (hideKeys.Has(key)) { sb.Append("*****,"); } else { sb.Append(nvc[key] + ","); } sb.AppendLine(); } return(sb.ToString()); }, $"Unable to obtain {name ?? "Unknown"}" );
public virtual string GetResponse(CaseInsensitiveBinaryList <string> hideKeys) => null;
public override string GetResponse(CaseInsensitiveBinaryList <string> hideKeys) => HighProperties.ContainsKey(ResultKey) ? HighProperties[ResultKey] : Response.AsString(hideKeys);
public override UserPreferenceSetting GetItem(CaseInsensitiveBinaryList <UserPreferenceSetting> settingsCollection, string key) => new UserPreferenceSetting();
public virtual T GetItem(CaseInsensitiveBinaryList <T> settingsCollection, string key) => settingsCollection.FindBinary(key);
public override VariableSetting GetItem(CaseInsensitiveBinaryList <VariableSetting> settingsCollection, string key) => new VariableSetting();
public override FeatureToggleSetting GetItem(CaseInsensitiveBinaryList <FeatureToggleSetting> settingsCollection, string key) => new FeatureToggleSetting();
/// <summary> /// Converts a NameValueCollection into a human readable string representation /// </summary> /// <param name="nvc">The NameValueCollection</param> /// <param name="hideKeys">If there is any values that need to be hidden</param> /// <returns>Human readable string</returns> public static string AsString(this NameValueCollection nvc, CaseInsensitiveBinaryList <string> hideKeys) => nvc.AsString(null, hideKeys);
public string GetLow(CaseInsensitiveBinaryList <string> hideKeys) => LowProperties.ToNameValueCollection().AsString(hideKeys);