Skip to content

Commit a7aa430

Browse files
committed
v1.0.1
- Fixed foreground color bug.
1 parent 06e08d7 commit a7aa430

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CLARiNET.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<PackageIcon>CLARiNET.ico</PackageIcon>
88
<PackageIconUrl />
99
<ApplicationIcon>CLARiNET.ico</ApplicationIcon>
10+
<Version>1.0.1</Version>
1011
</PropertyGroup>
1112

1213
<ItemGroup>

Program.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ namespace CLARiNET
99
{
1010
class Program
1111
{
12+
private static ConsoleColor _savedForegroundColor = Console.ForegroundColor;
13+
1214
static void Main(string[] args)
1315
{
1416
Options options = new Options();
1517
string url = "https://{host}/ccx/cc-cloud-repo/collections/";
1618
string host = "";
19+
Program._savedForegroundColor = Console.ForegroundColor;
1720

1821
try
1922
{
23+
Console.CancelKeyPress += new ConsoleCancelEventHandler(Cleanup);
2024
XDocument xDoc = XDocument.Parse(Resources.WDEnvironments);
2125
List<XElement> envs = new List<XElement>(xDoc.Descendants(XName.Get("env")));
2226

@@ -138,8 +142,19 @@ static void Main(string[] args)
138142
}
139143
catch (Exception ex)
140144
{
145+
Cleanup(null, null);
141146
Console.WriteLine(ex.Message);
142147
}
148+
finally
149+
{
150+
Cleanup(null, null);
151+
}
152+
}
153+
154+
protected static void Cleanup(object sender, ConsoleCancelEventArgs args)
155+
{
156+
Console.ForegroundColor = Program._savedForegroundColor;
157+
Console.CursorVisible = true;
143158
}
144159

145160
private static void PrintEnvironments(List<XElement> envs)

0 commit comments

Comments
 (0)