mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 11:13:46 +08:00
新增创建快捷方式的功能
This commit is contained in:
parent
c136b68922
commit
a8ce60bd98
@ -48,6 +48,8 @@ class AppConf {
|
|||||||
|
|
||||||
static const gameChannels = ["LIVE", "PTU", "EPTU"];
|
static const gameChannels = ["LIVE", "PTU", "EPTU"];
|
||||||
|
|
||||||
|
static const appShortCutName = "SC汉化盒子${AppConf.isMSE ? "" : "DEV"}.lnk";
|
||||||
|
|
||||||
static late final String applicationSupportDir;
|
static late final String applicationSupportDir;
|
||||||
|
|
||||||
static AppVersionData? networkVersionData;
|
static AppVersionData? networkVersionData;
|
||||||
|
@ -18,16 +18,9 @@ class AboutUI extends BaseUI<AboutUIModel> {
|
|||||||
const SizedBox(height: 64),
|
const SizedBox(height: 64),
|
||||||
Image.asset("assets/app_logo.png", width: 128, height: 128),
|
Image.asset("assets/app_logo.png", width: 128, height: 128),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
if (AppConf.isMSE)
|
const Text(
|
||||||
const Text(
|
"SC汉化盒子 V${AppConf.appVersion} ${AppConf.isMSE ? "" : " +Dev"}",
|
||||||
"SC汉化盒子 V${AppConf.appVersion}",
|
style: TextStyle(fontSize: 18)),
|
||||||
style: TextStyle(fontSize: 18),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
const Text(
|
|
||||||
"星际公民盒子 V${AppConf.appVersion}",
|
|
||||||
style: TextStyle(fontSize: 18),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Button(
|
Button(
|
||||||
onPressed: model.checkUpdate,
|
onPressed: model.checkUpdate,
|
||||||
@ -118,8 +111,7 @@ class AboutUI extends BaseUI<AboutUIModel> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
launchUrlString(
|
launchUrlString("https://github.com/StarCitizenToolBox/app");
|
||||||
"https://github.com/StarCitizenToolBox/app");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -32,10 +32,8 @@ class IndexUI extends BaseUI<IndexUIModel> {
|
|||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
if (AppConf.isMSE)
|
const Text(
|
||||||
const Text("SC汉化盒子 V${AppConf.appVersion}")
|
"SC汉化盒子 V${AppConf.appVersion} ${AppConf.isMSE ? "" : " +Dev"}")
|
||||||
else
|
|
||||||
const Text("星际公民盒子 V${AppConf.appVersion}"),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -12,7 +12,10 @@ class SettingUI extends BaseUI<SettingUIModel> {
|
|||||||
margin: const EdgeInsets.all(16),
|
margin: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
makeSettingsItem(const Icon(FluentIcons.link, size: 20), "创建设置快捷方式",
|
||||||
|
subTitle: "在桌面创建《SC汉化盒子》快捷方式", onTap: model.addShortCut),
|
||||||
if (AppConf.isMSE) ...[
|
if (AppConf.isMSE) ...[
|
||||||
|
const SizedBox(height: 12),
|
||||||
makeSettingsItem(
|
makeSettingsItem(
|
||||||
const Icon(FluentIcons.reset_device, size: 20), "重置自动密码填充",
|
const Icon(FluentIcons.reset_device, size: 20), "重置自动密码填充",
|
||||||
subTitle:
|
subTitle:
|
||||||
|
@ -149,4 +149,25 @@ class SettingUIModel extends BaseUIModel {
|
|||||||
reloadData();
|
reloadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> addShortCut() async {
|
||||||
|
dPrint(Platform.resolvedExecutable);
|
||||||
|
final script = """
|
||||||
|
\$targetPath = "${Platform.resolvedExecutable}";
|
||||||
|
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "${AppConf.appShortCutName}");
|
||||||
|
\$shell = New-Object -ComObject WScript.Shell
|
||||||
|
\$shortcut = \$shell.CreateShortcut(\$shortcutPath)
|
||||||
|
if (\$shortcut -eq \$null) {
|
||||||
|
Write-Host "Failed to create shortcut."
|
||||||
|
} else {
|
||||||
|
\$shortcut.TargetPath = \$targetPath
|
||||||
|
\$shortcut.Save()
|
||||||
|
Write-Host "Shortcut created successfully."
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
final r = await Process.run(SystemHelper.powershellPath, [script]);
|
||||||
|
dPrint(r.exitCode);
|
||||||
|
dPrint(r.stdout);
|
||||||
|
dPrint(r.stderr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user