aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-23 03:58:38 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-23 03:58:38 +0300
commit2d803e9410cd383d8e66c300f86fe0f7374c81ea (patch)
tree7ac7ac109fd8cafd0752673e826123475b9f0e13 /Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs
parent8d2b13aaa70bc6a8f521df4eab165caf078c33fa (diff)
downloadTango-2d803e9410cd383d8e66c300f86fe0f7374c81ea.tar.gz
Tango-2d803e9410cd383d8e66c300f86fe0f7374c81ea.zip
Improvements to DataStore Remote.
Diffstat (limited to 'Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs')
-rw-r--r--Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs b/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs
index bf78bc35e..53745990e 100644
--- a/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs
+++ b/Software/Visual_Studio/Tango.DataStore/DataStoreHelper.cs
@@ -83,5 +83,29 @@ namespace Tango.DataStore
throw new NotSupportedException("The specified data type is not supported.");
}
+
+ /// <summary>
+ /// Formats the data store item as a string.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <returns></returns>
+ public static String FormatDataStoreItem(IDataStoreItem item)
+ {
+ if (item.Type != DataType.Bytes)
+ {
+ return $"{item.Key}: {item.Value}";
+ }
+ else
+ {
+ byte[] bytes = (byte[])item.Value;
+
+ StringBuilder hex = new StringBuilder();
+ foreach (byte b in bytes)
+ {
+ hex.AppendFormat("{0:x2} ", b);
+ }
+ return hex.ToString();
+ }
+ }
}
}