SirCmpwn

Untitled

Apr 29th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.27 KB | None | 0 0
  1. static void RedrawInterface()
  2. {
  3. Console.Clear();
  4. Console.SetCursorPosition(0, 0);
  5. string bar = GenerateBar(Console.WindowWidth, ' ');
  6. bar = bar.Substring(title.Length);
  7. // Title bar
  8. Console.BackgroundColor = ConsoleColor.White;
  9. Console.ForegroundColor = ConsoleColor.Black;
  10. Console.Write(title + bar);
  11. // Menu
  12. DrawMenu();
  13. // Chrome
  14. bar = GenerateBar(Console.WindowWidth - 1, ' ');
  15. Console.SetCursorPosition(0, Console.WindowHeight - 1);
  16. Console.Write(bar);
  17. // Fix bottom right corner
  18. if (Type.GetType("Mono.Runtime") == null)
  19. Console.MoveBufferArea(0, Console.WindowHeight - 1, 1, 1, Console.WindowWidth - 1, Console.WindowHeight - 1);
  20. bar += ' ';
  21. for (int y = 2; y < Console.WindowHeight - 1; y++)
  22. {
  23. Console.SetCursorPosition(0, y);
  24. Console.Write(' ');
  25. Console.SetCursorPosition(Console.WindowWidth - 1, y);
  26. Console.Write(' ');
  27. }
  28. Console.BackgroundColor = ConsoleColor.White;
  29. bar = GenerateBar(Console.WindowWidth - 2, ' ');
  30. Console.SetCursorPosition(1, 2);
  31. Console.Write(bar);
  32. Console.SetCursorPosition(2, 2);
  33. Console.ForegroundColor = ConsoleColor.Black;
  34. bar = GenerateBar(LEM1801.Width + 2, ' ');
  35. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 3, LEM1801.Height + 3);
  36. Console.Write(bar);
  37. for (int y = 2; y < Console.WindowHeight - 1; y++)
  38. {
  39. Console.SetCursorPosition(1, y);
  40. Console.Write(' ');
  41. Console.SetCursorPosition(Console.WindowWidth - 2, y);
  42. Console.Write(' ');
  43. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 3, y);
  44. Console.Write(' ');
  45. }
  46. Console.SetCursorPosition(2, 2);
  47. // File bar
  48. foreach (WorkingFile file in OpenFiles)
  49. {
  50. if (!file.Modified)
  51. Console.Write(Path.GetFileName(file.FileName) + " ");
  52. else
  53. Console.Write(Path.GetFileName(file.FileName) + "* ");
  54. Console.ForegroundColor = ConsoleColor.DarkGray;
  55. }
  56. bar = GenerateBar(Console.WindowWidth - 2, ' ');
  57. Console.SetCursorPosition(1, Console.WindowHeight - 2);
  58. Console.Write(bar);
  59. Console.BackgroundColor = ConsoleColor.White;
  60. Console.ForegroundColor = ConsoleColor.Black;
  61. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, LEM1801.Height + 3);
  62. Console.Write("Registers");
  63. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, 2);
  64. Console.WriteLine("Emulator");
  65. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, 3);
  66. Console.ForegroundColor = ConsoleColor.White;
  67. Console.BackgroundColor = ConsoleColor.Black;
  68. Screen.DrawScreen();
  69. DrawRectangle(Console.WindowWidth - LEM1801.Width - 2, LEM1801.Height + 4, Console.WindowWidth - 2, Console.WindowHeight - 2, ConsoleColor.DarkGray);
  70. string[] test = new string[]
  71. {
  72. "A: 0x1234",
  73. "B: 0x1234",
  74. "C: 0x1234",
  75. "X: 0x1234",
  76. "Y: 0x1234",
  77. "Z: 0x1234",
  78. "I: 0x1234",
  79. "J: 0x1234",
  80. "PC: 0x1234",
  81. "SP: 0x1234",
  82. "EX: 0x1234",
  83. "IA: 0x1234",
  84. };
  85. Console.BackgroundColor = ConsoleColor.DarkGray;
  86. Console.ForegroundColor = ConsoleColor.White;
  87. Console.CursorTop = LEM1801.Height + 3;
  88. int i = 0;
  89. foreach (string s in test)
  90. {
  91. if (i < 6)
  92. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width + 2, Console.CursorTop + 1);
  93. else
  94. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width + 15, Console.CursorTop + 1);
  95. Console.Write(s);
  96. i++;
  97. if (i == 6)
  98. Console.CursorTop = LEM1801.Height + 3;
  99. }
  100. Console.BackgroundColor = ConsoleColor.White;
  101. Console.ForegroundColor = ConsoleColor.Black;
  102. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
  103. bar = GenerateBar(LEM1801.Width, ' ');
  104. Console.Write(bar);
  105. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
  106. Console.Write("Disassembly");
  107. Console.ForegroundColor = ConsoleColor.White;
  108. Console.BackgroundColor = ConsoleColor.Black;
  109. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
  110. Console.Write("[0" + LongHex(0x1234) + "]: SET A, B");
  111. Console.BackgroundColor = ConsoleColor.DarkGray;
  112. for (int j = 0x1235; j - 0x1235 < 7; j++)
  113. {
  114. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
  115. Console.Write("[0" + LongHex((ushort)j) + "]: SET A, B");
  116. }
  117. Console.BackgroundColor = ConsoleColor.White;
  118. Console.ForegroundColor = ConsoleColor.Black;
  119. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
  120. Console.Write(bar);
  121. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop);
  122. Console.Write("Memory");
  123. Console.BackgroundColor = ConsoleColor.DarkGray;
  124. Console.ForegroundColor = ConsoleColor.White;
  125. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
  126. Console.Write("[0" + LongHex(0x1234) + "]:");
  127. Console.ForegroundColor = ConsoleColor.White;
  128. Console.BackgroundColor = ConsoleColor.Black;
  129. Console.Write(" 6D30 ");
  130. Console.BackgroundColor = ConsoleColor.DarkGray;
  131. Console.Write("2A23 5F2D 8C34");
  132. Random r = new Random();
  133. for (int j = 0x1238; j - 0x1238 < 16 * 4; j += 4)
  134. {
  135. Console.SetCursorPosition(Console.WindowWidth - LEM1801.Width - 2, Console.CursorTop + 1);
  136. Console.Write("[0" + LongHex((ushort)j) + "]: ");
  137. for (int k = 0; k < 4; k++)
  138. Console.Write(LongHex((ushort)r.Next()) + " ");
  139. }
  140. // Draw open file
  141. DrawRectangle(2, 3, Console.WindowWidth - LEM1801.Width - 4, Console.WindowHeight - 3, ConsoleColor.Black);
  142. Console.SetCursorPosition(2, 3);
  143. SyntaxHighlighting.DrawHighlightedText(OpenFiles[FocusedFile].Contents,
  144. Console.WindowWidth - LEM1801.Width - 4, Console.WindowHeight - 3, 0, BreakpointLines);
  145. }
Advertisement
Add Comment
Please, Sign In to add comment