Skip to content

Commit 1c54a29

Browse files
committed
Renamed "TestRig" project to "Utilities"since that is really what it embodies.
1 parent 7ccd5b2 commit 1c54a29

File tree

11 files changed

+119
-27
lines changed

11 files changed

+119
-27
lines changed

Code Grapher/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.20080.1")]
36-
[assembly: AssemblyFileVersion("1.0.20080.1")]
35+
[assembly: AssemblyVersion("1.1.20081.2")]
36+
[assembly: AssemblyFileVersion("1.1.20081.2")]

Common/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.20080.9")]
36-
[assembly: AssemblyFileVersion("1.0.20080.9")]
35+
[assembly: AssemblyVersion("1.1.20081.2")]
36+
[assembly: AssemblyFileVersion("1.1.20081.2")]

Grun.Net.sln

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grun", "Grun\Grun.csproj",
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GunWin", "GunWin\GunWin.csproj", "{A3568FA3-D6B3-4165-AF95-CDB78D86F416}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRig", "TestRig\TestRig.csproj", "{4E020F1D-27BF-4853-8573-474D7EDB4E72}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utilities", "TestRig\Utilities.csproj", "{4E020F1D-27BF-4853-8573-474D7EDB4E72}"
1111
EndProject
1212
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7B8535ED-1440-4F63-9F90-A086FD870EF3}"
1313
ProjectSection(SolutionItems) = preProject
@@ -64,15 +64,4 @@ Global
6464
GlobalSection(ExtensibilityGlobals) = postSolution
6565
SolutionGuid = {A1CB1A18-09C5-4D7F-916D-2346D29A8563}
6666
EndGlobalSection
67-
GlobalSection(AutomaticVersions) = postSolution
68-
UpdateAssemblyVersion = True
69-
UpdateAssemblyFileVersion = True
70-
UpdateAssemblyInfoVersion = True
71-
AssemblyVersionSettings = None.None.DateStamp.IncrementWithResetOnIncrease
72-
AssemblyFileVersionSettings = None.None.DateStamp.IncrementWithResetOnIncrease
73-
AssemblyInfoVersionSettings = None.None.DateStamp.IncrementWithResetOnIncrease
74-
UpdatePackageVersion = False
75-
AssemblyInfoVersionType = SettingsVersion
76-
InheritWinAppVersionFrom = None
77-
EndGlobalSection
7867
EndGlobal

Grun/Grun.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<Reference Include="System.Xml" />
6565
</ItemGroup>
6666
<ItemGroup>
67+
<Compile Include="SyntaxHighlighting\ConsoleReader.cs" />
6768
<Compile Include="SyntaxHighlighting\ConsoleWrapperColor.cs" />
6869
<Compile Include="SyntaxHighlighting\HighlightingTokenCache.cs" />
6970
<Compile Include="Options.cs">
@@ -99,9 +100,9 @@
99100
<Project>{a3568fa3-d6b3-4165-af95-cdb78d86f416}</Project>
100101
<Name>GunWin</Name>
101102
</ProjectReference>
102-
<ProjectReference Include="..\TestRig\TestRig.csproj">
103+
<ProjectReference Include="..\TestRig\Utilities.csproj">
103104
<Project>{4e020f1d-27bf-4853-8573-474d7edb4e72}</Project>
104-
<Name>TestRig</Name>
105+
<Name>Utilities</Name>
105106
</ProjectReference>
106107
</ItemGroup>
107108
<ItemGroup>

Grun/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.20081.16")]
36-
[assembly: AssemblyFileVersion("1.0.20081.16")]
35+
[assembly: AssemblyVersion("1.1.20081.20")]
36+
[assembly: AssemblyFileVersion("1.1.20081.20")]
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Runtime.InteropServices;
5+
using System.Text;
6+
7+
namespace Org.Edgerunner.ANTLR4.Tools.Testing.Grun.SyntaxHighlighting
8+
{
9+
public class ConsoleReader
10+
{
11+
public static IEnumerable<string> ReadFromBuffer(short x, short y, short width, short height)
12+
{
13+
IntPtr buffer = Marshal.AllocHGlobal(width * height * Marshal.SizeOf(typeof(CHAR_INFO)));
14+
if (buffer == null)
15+
throw new OutOfMemoryException();
16+
17+
try
18+
{
19+
COORD coord = new COORD();
20+
SMALL_RECT rc = new SMALL_RECT();
21+
rc.Left = x;
22+
rc.Top = y;
23+
rc.Right = (short)(x + width - 1);
24+
rc.Bottom = (short)(y + height - 1);
25+
26+
COORD size = new COORD();
27+
size.X = width;
28+
size.Y = height;
29+
30+
const int STD_OUTPUT_HANDLE = -11;
31+
if (!ReadConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), buffer, size, coord, ref rc))
32+
{
33+
// 'Not enough storage is available to process this command' may be raised for buffer size > 64K (see ReadConsoleOutput doc.)
34+
throw new Win32Exception(Marshal.GetLastWin32Error());
35+
}
36+
37+
IntPtr ptr = buffer;
38+
for (int h = 0; h < height; h++)
39+
{
40+
StringBuilder sb = new StringBuilder();
41+
for (int w = 0; w < width; w++)
42+
{
43+
CHAR_INFO ci = (CHAR_INFO)Marshal.PtrToStructure(ptr, typeof(CHAR_INFO));
44+
char[] chars = Console.OutputEncoding.GetChars(ci.charData);
45+
sb.Append(chars[0]);
46+
ptr += Marshal.SizeOf(typeof(CHAR_INFO));
47+
}
48+
yield return sb.ToString();
49+
}
50+
}
51+
finally
52+
{
53+
Marshal.FreeHGlobal(buffer);
54+
}
55+
}
56+
57+
[StructLayout(LayoutKind.Sequential)]
58+
private struct CHAR_INFO
59+
{
60+
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
61+
public byte[] charData;
62+
public short attributes;
63+
}
64+
65+
[StructLayout(LayoutKind.Sequential)]
66+
private struct COORD
67+
{
68+
public short X;
69+
public short Y;
70+
}
71+
72+
[StructLayout(LayoutKind.Sequential)]
73+
private struct SMALL_RECT
74+
{
75+
public short Left;
76+
public short Top;
77+
public short Right;
78+
public short Bottom;
79+
}
80+
81+
[StructLayout(LayoutKind.Sequential)]
82+
private struct CONSOLE_SCREEN_BUFFER_INFO
83+
{
84+
public COORD dwSize;
85+
public COORD dwCursorPosition;
86+
public short wAttributes;
87+
public SMALL_RECT srWindow;
88+
public COORD dwMaximumWindowSize;
89+
}
90+
91+
[DllImport("kernel32.dll", SetLastError = true)]
92+
private static extern bool ReadConsoleOutput(IntPtr hConsoleOutput, IntPtr lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, ref SMALL_RECT lpReadRegion);
93+
94+
[DllImport("kernel32.dll", SetLastError = true)]
95+
private static extern IntPtr GetStdHandle(int nStdHandle);
96+
}
97+
}

Grun/SyntaxHighlighting/ConsoleWrapperText.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ public static void SetCursorPosition(int left, int top)
106106
Colorful.Console.SetCursorPosition(left, top);
107107
}
108108

109+
public static void BackSpace()
110+
{
111+
112+
}
113+
109114
public static void Write(string value)
110115
{
111116
if (value.EndsWith("\r\n") || value.EndsWith("\n"))

GunWin/GunWin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@
173173
<Project>{8bd992fd-a3b3-4af9-9371-5aa14ddfda68}</Project>
174174
<Name>Common</Name>
175175
</ProjectReference>
176-
<ProjectReference Include="..\TestRig\TestRig.csproj">
176+
<ProjectReference Include="..\TestRig\Utilities.csproj">
177177
<Project>{4e020f1d-27bf-4853-8573-474d7edb4e72}</Project>
178-
<Name>TestRig</Name>
178+
<Name>Utilities</Name>
179179
</ProjectReference>
180180
</ItemGroup>
181181
<ItemGroup>

GunWin/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.20081.2")]
36-
[assembly: AssemblyFileVersion("1.0.20081.2")]
35+
[assembly: AssemblyVersion("1.1.20081.20")]
36+
[assembly: AssemblyFileVersion("1.1.20081.20")]

TestRig/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.20080.12")]
36-
[assembly: AssemblyFileVersion("1.0.20080.12")]
35+
[assembly: AssemblyVersion("1.1.20081.6")]
36+
[assembly: AssemblyFileVersion("1.1.20081.6")]

0 commit comments

Comments
 (0)