mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-07 01:26:14 -08:00
Try to avoid some .Net Framework 4.8 features
This commit is contained in:
13
src/Setup.cs
13
src/Setup.cs
@@ -519,7 +519,7 @@ public class Setup {
|
|||||||
*/
|
*/
|
||||||
protected void VerifyLoaderConfig() {
|
protected void VerifyLoaderConfig() {
|
||||||
var lines = File.ReadAllLines("config.txt");
|
var lines = File.ReadAllLines("config.txt");
|
||||||
var loader = lines.Where(s => s.StartsWith("boot=")).Select(s => s.Substring(5)).Prepend("").Last();
|
var loader = lines.Where(s => s.StartsWith("boot=")).Select(s => s.Substring(5)).LastOrDefault();
|
||||||
if (loader == null) {
|
if (loader == null) {
|
||||||
throw new SetupException("config.txt does not contain a boot=... line!");
|
throw new SetupException("config.txt does not contain a boot=... line!");
|
||||||
}
|
}
|
||||||
@@ -716,8 +716,13 @@ public class Setup {
|
|||||||
* @param arch The architecture.
|
* @param arch The architecture.
|
||||||
*/
|
*/
|
||||||
protected void SetArch(string arch) {
|
protected void SetArch(string arch) {
|
||||||
var detectedArch = DetectArchFromOS();
|
var detectedArch = Environment.Is64BitOperatingSystem ? "x64" : "ia32";
|
||||||
if (arch == "") {
|
try {
|
||||||
|
detectedArch = DetectArchFromOS();
|
||||||
|
} catch {
|
||||||
|
WriteLine($"Failed to detect OS architecture, assuming {detectedArch}.");
|
||||||
|
}
|
||||||
|
if (arch == "" || arch == null) {
|
||||||
EfiArch = detectedArch;
|
EfiArch = detectedArch;
|
||||||
WriteLine($"Your OS uses arch={EfiArch}. This will be checked again during installation.");
|
WriteLine($"Your OS uses arch={EfiArch}. This will be checked again during installation.");
|
||||||
} else {
|
} else {
|
||||||
@@ -963,7 +968,7 @@ public class Setup {
|
|||||||
Batch = args.Contains("batch");
|
Batch = args.Contains("batch");
|
||||||
ForwardArguments = String.Join(" ", args.Where(s => s == "dry-run" || s == "batch" || s.StartsWith("arch=")));
|
ForwardArguments = String.Join(" ", args.Where(s => s == "dry-run" || s == "batch" || s.StartsWith("arch=")));
|
||||||
try {
|
try {
|
||||||
SetArch(args.Prepend("arch=").Last(s => s.StartsWith("arch=")).Substring(5));
|
SetArch(args.Where(s => s.StartsWith("arch=")).Select(s => s.Substring(5)).LastOrDefault());
|
||||||
if (args.Contains("is-elevated") && !HasPrivileges() && !DryRun) {
|
if (args.Contains("is-elevated") && !HasPrivileges() && !DryRun) {
|
||||||
WriteLine("This installer needs to be run as administrator!");
|
WriteLine("This installer needs to be run as administrator!");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user