Upgrade to .NET 5

This commit is contained in:
NextTurn
2020-08-19 00:00:00 +08:00
committed by Next Turn
parent dcf3013f75
commit 3bfa46f5b0
9 changed files with 32 additions and 28 deletions

View File

@@ -46,7 +46,7 @@ namespace WinSW
}
using Process current = Process.GetCurrentProcess();
return current.MainModule.FileName;
return current.MainModule!.FileName!;
}
}
@@ -463,7 +463,7 @@ namespace WinSW
if (username is null)
{
Console.Write("Username: ");
username = Console.ReadLine();
username = Console.ReadLine()!;
}
if (password is null && !IsSpecialAccount(username))
@@ -798,7 +798,7 @@ namespace WinSW
_ = evt.WaitOne();
Console.CancelKeyPress -= CancelKeyPress;
void CancelKeyPress(object sender, ConsoleCancelEventArgs e)
void CancelKeyPress(object? sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
evt.Set();
@@ -968,14 +968,14 @@ namespace WinSW
{
UseShellExecute = true,
Verb = "runas",
FileName = current.MainModule.FileName,
FileName = current.MainModule!.FileName!,
Arguments = arguments,
WindowStyle = ProcessWindowStyle.Hidden,
};
try
{
using Process elevated = Process.Start(startInfo);
using Process elevated = Process.Start(startInfo)!;
elevated.WaitForExit();
Environment.Exit(elevated.ExitCode);