This commit is contained in:
xkeyC 2024-06-16 09:14:51 +08:00
parent 536daa176a
commit 62289b3b30
3 changed files with 16 additions and 12 deletions

View File

@ -83,10 +83,7 @@ class Unp4kCModel extends _$Unp4kCModel {
errorMessage: "${state.errorMessage}\n${event.data}");
}
if (!_hasUnp4kRunTimeError) {
if (state.errorMessage.contains(
"You must install .NET to run this application") ||
state.errorMessage.contains(
"You must install or update .NET to run this application")) {
if (checkRunTimeError(state.errorMessage)) {
_hasUnp4kRunTimeError = true;
AnalyticsApi.touch("unp4k_no_runtime");
}
@ -246,6 +243,19 @@ class Unp4kCModel extends _$Unp4kCModel {
}
}
static bool checkRunTimeError(String errorMessage) {
if (errorMessage
.contains("You must install .NET to run this application") ||
errorMessage.contains(
"You must install or update .NET to run this application") ||
errorMessage.contains(
"It was not possible to find any compatible framework version")) {
AnalyticsApi.touch("unp4k_no_runtime");
return true;
}
return false;
}
static Future<Uint8List> unp4kTools(
String applicationBinaryModuleDir, List<String> args) async {
await BinaryModuleConf.extractModule(

View File

@ -235,10 +235,7 @@ class AdvancedLocalizationUIModel extends _$AdvancedLocalizationUIModel {
return iniData;
} catch (e) {
final errorMessage = e.toString();
if (errorMessage
.contains("You must install .NET to run this application") ||
errorMessage.contains(
"You must install or update .NET to run this application")) {
if (Unp4kCModel.checkRunTimeError(errorMessage)) {
AnalyticsApi.touch("advanced_localization_no_runtime");
}
state = state.copyWith(

View File

@ -302,10 +302,7 @@ class UnP4kErrorWidget extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (errorMessage.contains(
"You must install .NET to run this application") ||
errorMessage.contains(
"You must install or update .NET to run this application")) ...[
if (Unp4kCModel.checkRunTimeError(errorMessage)) ...[
Text(
S.current.tools_unp4k_missing_runtime,
style: const TextStyle(fontSize: 16),