/
MemoryViewUC.xaml.cs
49 lines (42 loc) · 1.2 KB
/
MemoryViewUC.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media;
namespace Cosmos.VS.Windows {
public partial class MemoryViewUC : UserControl {
FontFamily mFont = new FontFamily("Consolas");
public MemoryViewUC() {
InitializeComponent();
}
public string Title {
get { return tblkLabel.Text; }
set { tblkLabel.Text = value; }
}
static public List<UInt32> Split(byte[] aData) {
var xResult = new List<UInt32>(aData.Length / 4);
for (int i = 0; i < aData.Length; i = i + 4) {
UInt32 xValue = (UInt32)
(aData[i + 3] << 24 |
aData[i + 2] << 16 |
aData[i + 1] << 8 |
aData[i]);
xResult.Add(xValue);
}
return xResult;
}
public void Clear() {
spnlLabel.Children.Clear();
spnlAddress.Children.Clear();
spnlData.Children.Clear();
}
public void Add(string aLabel, UInt32 aData) {
var xLabel = new TextBlock();
xLabel.FontFamily = mFont;
xLabel.Text = aLabel;
spnlLabel.Children.Add(xLabel);
var xData = new DataBytesUC();
xData.Value = aData;
spnlData.Children.Add(xData);
}
}
}