Cosmos/source/Cosmos.VS.Windows/ToolWindows/MemoryViewUC.xaml.cs
2017-12-07 19:13:31 +00:00

49 lines
1.2 KiB
C#

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);
}
}
}