length of data

alphons <alphons@heijden.com> 16 Jan 2025, 13:33
f90baa02513b89be595301e034860e24c6dfa44b
2 files changed
  • RedisGui/FormMain.cs
  • RedisGui/Helper.cs
diff --git a/RedisGui/FormMain.cs b/RedisGui/FormMain.cs
index 8b3fe32..f3a2204 100644
--- a/RedisGui/FormMain.cs
+++ b/RedisGui/FormMain.cs
@@ -116,14 +116,17 @@ public partial class FormMain : Form
val = TimeSpan.FromMilliseconds(long.Parse(val) / 10000).ToString();
break;
case "data":
- if (val.StartsWith('{') && val.EndsWith('}')) // and [] ??
+ name += $" ({val.Length})";
+ if ((val.StartsWith('{') && val.EndsWith('}')) || (val.StartsWith('[') && val.EndsWith(']')))
+ {
this.txtData.Text = Helper.PrettyPrintJson(val);
- if (val[0] == 0x02)
+ }
+ if (val[0] == 0x02) // version 2.0
{
if (entry.Value.Box() is byte[] buffer)
{
//this.txtData.Text = Helper.ConvertByteArrayToHexText(buffer);
- Helper.SessionDecoder(this.listView1, entry.Name.ToString(), buffer);
+ Helper.SessionDecoder(this.listView1, name, buffer);
continue;
}
}
@@ -131,7 +134,7 @@ public partial class FormMain : Form
}
}
- this.listView1.Items.Add(new ListViewItem([entry.Name.ToString(), val]));
+ this.listView1.Items.Add(new ListViewItem([name, val]));
}
break;
case RedisType.List:
diff --git a/RedisGui/Helper.cs b/RedisGui/Helper.cs
index c53661b..3843695 100644
--- a/RedisGui/Helper.cs
+++ b/RedisGui/Helper.cs
@@ -53,7 +53,7 @@ public class Helper
public static void SessionDecoder(ListView lv, string entryName, byte[] b)
{
- var lvi = new ListViewItem([entryName, $"*binary* (len {b.Length})"]);
+ var lvi = new ListViewItem([entryName, $"*binary*"]);
lvi.Tag = b;
lv.Items.Add(lvi);
lv.Items.Add(new ListViewItem(["--------------", "--------------"]));