mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-02-06 15:10:20 +00:00
feat: WASM web support
This commit is contained in:
@@ -30,7 +30,7 @@ class SystemHelper {
|
||||
"-Path",
|
||||
"\"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\stornvme\\Parameters\\Device\"",
|
||||
"-Name",
|
||||
"\"ForcedPhysicalSectorSizeInBytes\""
|
||||
"\"ForcedPhysicalSectorSizeInBytes\"",
|
||||
]);
|
||||
dPrint("checkNvmePatchStatus result ==== ${result.stdout}");
|
||||
if (result.stderr == "" && result.stdout.toString().contains("{* 4095}")) {
|
||||
@@ -52,7 +52,7 @@ class SystemHelper {
|
||||
"ForcedPhysicalSectorSizeInBytes",
|
||||
"-PropertyType MultiString",
|
||||
"-Force -Value",
|
||||
"\"* 4095\""
|
||||
"\"* 4095\"",
|
||||
]);
|
||||
dPrint("nvme_PhysicalBytes result == ${result.stdout}");
|
||||
return result.stderr;
|
||||
@@ -65,7 +65,7 @@ class SystemHelper {
|
||||
"-Path",
|
||||
"\"HKLM:\\SYSTEM\\CurrentControlSet\\Services\\stornvme\\Parameters\\Device\"",
|
||||
"-Name",
|
||||
"\"ForcedPhysicalSectorSizeInBytes\""
|
||||
"\"ForcedPhysicalSectorSizeInBytes\"",
|
||||
]);
|
||||
dPrint("doRemoveNvmePath result ==== ${result.stdout}");
|
||||
if (result.stderr == "") {
|
||||
@@ -97,8 +97,9 @@ class SystemHelper {
|
||||
"$programDataPath\\Microsoft\\Windows\\Start Menu\\Programs\\Roberts Space Industries\\RSI Launcher.lnk";
|
||||
final rsiLinkFile = File(rsiFilePath);
|
||||
if (await rsiLinkFile.exists()) {
|
||||
final r = await Process.run(SystemHelper.powershellPath,
|
||||
["(New-Object -ComObject WScript.Shell).CreateShortcut(\"$rsiFilePath\").targetpath"]);
|
||||
final r = await Process.run(SystemHelper.powershellPath, [
|
||||
"(New-Object -ComObject WScript.Shell).CreateShortcut(\"$rsiFilePath\").targetpath",
|
||||
]);
|
||||
if (r.stdout.toString().contains("RSI Launcher.exe")) {
|
||||
final start = r.stdout.toString().split("RSI Launcher.exe");
|
||||
if (skipEXE) {
|
||||
@@ -147,22 +148,15 @@ class SystemHelper {
|
||||
if (processorAffinity == null) {
|
||||
Process.run(path, []);
|
||||
} else {
|
||||
Process.run("cmd.exe", [
|
||||
'/C',
|
||||
'Start',
|
||||
'""',
|
||||
'/High',
|
||||
'/Affinity',
|
||||
processorAffinity,
|
||||
path,
|
||||
]);
|
||||
Process.run("cmd.exe", ['/C', 'Start', '""', '/High', '/Affinity', processorAffinity, path]);
|
||||
}
|
||||
dPrint(path);
|
||||
}
|
||||
|
||||
static Future<int> getSystemMemorySizeGB() async {
|
||||
final r = await Process.run(
|
||||
powershellPath, ["(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb"]);
|
||||
final r = await Process.run(powershellPath, [
|
||||
"(Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb",
|
||||
]);
|
||||
return int.tryParse(r.stdout.toString().trim()) ?? 0;
|
||||
}
|
||||
|
||||
@@ -196,10 +190,9 @@ foreach ($adapter in $adapterMemory) {
|
||||
}
|
||||
|
||||
static Future<String> getDiskInfo() async {
|
||||
return (await Process.run(powershellPath, ["Get-PhysicalDisk | format-table BusType,FriendlyName,Size"]))
|
||||
.stdout
|
||||
.toString()
|
||||
.trim();
|
||||
return (await Process.run(powershellPath, [
|
||||
"Get-PhysicalDisk | format-table BusType,FriendlyName,Size",
|
||||
])).stdout.toString().trim();
|
||||
}
|
||||
|
||||
static Future<int> getDirLen(String path, {List<String>? skipPath}) async {
|
||||
@@ -226,8 +219,9 @@ foreach ($adapter in $adapterMemory) {
|
||||
}
|
||||
|
||||
static Future<int> getNumberOfLogicalProcessors() async {
|
||||
final cpuNumberResult =
|
||||
await Process.run(powershellPath, ["(Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors"]);
|
||||
final cpuNumberResult = await Process.run(powershellPath, [
|
||||
"(Get-WmiObject -Class Win32_Processor).NumberOfLogicalProcessors",
|
||||
]);
|
||||
if (cpuNumberResult.exitCode != 0) return 0;
|
||||
return int.tryParse(cpuNumberResult.stdout.toString().trim()) ?? 0;
|
||||
}
|
||||
@@ -257,8 +251,10 @@ foreach ($adapter in $adapterMemory) {
|
||||
static Future openDir(dynamic path, {bool isFile = false}) async {
|
||||
dPrint("SystemHelper.openDir path === $path");
|
||||
if (Platform.isWindows) {
|
||||
await Process.run(
|
||||
SystemHelper.powershellPath, ["explorer.exe", isFile ? "/select,$path" : "\"/select,\"$path\"\""]);
|
||||
await Process.run(SystemHelper.powershellPath, [
|
||||
"explorer.exe",
|
||||
isFile ? "/select,$path" : "\"/select,\"$path\"\"",
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user