mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Adding AppendPropertyRaw method to ReprStringBuilder
This commit is contained in:
parent
5e80ddcc16
commit
b1b12c76dd
1 changed files with 19 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ namespace ICD.Common.Utils
|
||||||
private readonly object m_Instance;
|
private readonly object m_Instance;
|
||||||
|
|
||||||
private readonly List<string> m_PropertyOrder;
|
private readonly List<string> m_PropertyOrder;
|
||||||
private readonly Dictionary<string, object> m_PropertyValues;
|
private readonly Dictionary<string, string> m_PropertyValues;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
|
|
@ -24,11 +24,11 @@ namespace ICD.Common.Utils
|
||||||
m_Instance = instance;
|
m_Instance = instance;
|
||||||
|
|
||||||
m_PropertyOrder = new List<string>();
|
m_PropertyOrder = new List<string>();
|
||||||
m_PropertyValues = new Dictionary<string, object>();
|
m_PropertyValues = new Dictionary<string, string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the property with the given name and value to the
|
/// Adds the property with the given name and value to the builder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
|
|
@ -37,6 +37,21 @@ namespace ICD.Common.Utils
|
||||||
m_PropertyOrder.Remove(name);
|
m_PropertyOrder.Remove(name);
|
||||||
m_PropertyOrder.Add(name);
|
m_PropertyOrder.Add(name);
|
||||||
|
|
||||||
|
string valueString = GetValueStringRepresentation(value);
|
||||||
|
|
||||||
|
m_PropertyValues[name] = valueString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the property with the given name and value to the builder without any additonal formatting.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public void AppendPropertyRaw(string name, string value)
|
||||||
|
{
|
||||||
|
m_PropertyOrder.Remove(name);
|
||||||
|
m_PropertyOrder.Add(name);
|
||||||
|
|
||||||
m_PropertyValues[name] = value;
|
m_PropertyValues[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,8 +75,7 @@ namespace ICD.Common.Utils
|
||||||
builder.Append(property);
|
builder.Append(property);
|
||||||
builder.Append('=');
|
builder.Append('=');
|
||||||
|
|
||||||
object value = m_PropertyValues[property];
|
string valueString = m_PropertyValues[property];
|
||||||
string valueString = GetValueStringRepresentation(value);
|
|
||||||
builder.Append(valueString);
|
builder.Append(valueString);
|
||||||
|
|
||||||
if (index < m_PropertyOrder.Count - 1)
|
if (index < m_PropertyOrder.Count - 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue