PageRenderTime 58ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/source2/VSIP/Cosmos.VS.Windows/MemoryViewUC.xaml.cs

https://bitbucket.org/mvptracker/cosmos
C# | 58 lines | 51 code | 7 blank | 0 comment | 1 complexity | 586cdc51fdd71bf3be3470a5ac8fe893 MD5 | raw file
Possible License(s): BSD-2-Clause
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. namespace Cosmos.VS.Windows {
  15. public partial class MemoryViewUC : UserControl {
  16. FontFamily mFont = new FontFamily("Consolas");
  17. public MemoryViewUC() {
  18. InitializeComponent();
  19. }
  20. public string Title {
  21. get { return tblkLabel.Text; }
  22. set { tblkLabel.Text = value; }
  23. }
  24. static public List<UInt32> Split(byte[] aData) {
  25. var xResult = new List<UInt32>(aData.Length / 4);
  26. for (int i = 0; i < aData.Length; i = i + 4) {
  27. UInt32 xValue = (UInt32)
  28. (aData[i + 3] << 24 |
  29. aData[i + 2] << 16 |
  30. aData[i + 1] << 8 |
  31. aData[i]);
  32. xResult.Add(xValue);
  33. }
  34. return xResult;
  35. }
  36. public void Clear() {
  37. spnlLabel.Children.Clear();
  38. spnlAddress.Children.Clear();
  39. spnlData.Children.Clear();
  40. }
  41. public void Add(string aLabel, UInt32 aData) {
  42. var xLabel = new TextBlock();
  43. xLabel.FontFamily = mFont;
  44. xLabel.Text = aLabel;
  45. spnlLabel.Children.Add(xLabel);
  46. var xData = new DataBytesUC();
  47. xData.Value = aData;
  48. spnlData.Children.Add(xData);
  49. }
  50. }
  51. }