installService method
Implementation
@override
Future<bool> installService({
required String serviceName,
required String displayName,
required String description,
}) async {
try {
final io.Directory dir = await ProfileStorage().getStorageDirectory();
final String usingConfig = (await ProfileStorage().getUsingConfig()).path;
HelperConfig config = HelperConfig(
helperServiceName: serviceName,
helperServiceDisplayName: displayName,
helperServiceDescription: description,
singBoxExecute: p.join(dir.path, WindowsConstants.singBoxFileName),
singBoxConfig: usingConfig,
);
final io.File helperExe = io.File(p.join(dir.path, WindowsConstants.helperFileName));
if (!await helperExe.exists()) {
return false;
}
final cli = _buildCli(dir);
return cli.install(config);
} catch (e) {
debugPrint('flutter_sing_box 插件安装服务失败, $e');
return false;
}
}