2024-03-10 16:26:04 +08:00
|
|
|
// ignore_for_file: avoid_build_context_in_providers
|
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:archive/archive_io.dart';
|
|
|
|
import 'package:fluent_ui/fluent_ui.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
2024-03-17 17:19:37 +08:00
|
|
|
import 'package:hive/hive.dart';
|
2024-03-10 16:26:04 +08:00
|
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
|
|
|
import 'package:starcitizen_doctor/api/api.dart';
|
2024-03-10 21:25:03 +08:00
|
|
|
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
2024-03-10 16:26:04 +08:00
|
|
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
|
|
|
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
|
|
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
|
|
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
|
|
|
import 'package:starcitizen_doctor/data/sc_localization_data.dart';
|
2024-03-16 19:13:49 +08:00
|
|
|
import 'package:starcitizen_doctor/generated/no_l10n_strings.dart';
|
2024-03-10 16:26:04 +08:00
|
|
|
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
|
|
|
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
|
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
|
|
|
|
part 'localization_ui_model.g.dart';
|
|
|
|
|
|
|
|
part 'localization_ui_model.freezed.dart';
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class LocalizationUIState with _$LocalizationUIState {
|
2024-03-15 00:01:06 +08:00
|
|
|
factory LocalizationUIState({
|
2024-03-10 16:26:04 +08:00
|
|
|
String? selectedLanguage,
|
|
|
|
Map<String, ScLocalizationData>? apiLocalizationData,
|
|
|
|
@Default("") String workingVersion,
|
|
|
|
MapEntry<bool, String>? patchStatus,
|
2024-05-05 14:59:07 +08:00
|
|
|
bool? isInstalledAdvanced,
|
2024-03-10 16:26:04 +08:00
|
|
|
List<String>? customizeList,
|
|
|
|
@Default(false) bool enableCustomize,
|
|
|
|
}) = _LocalizationUIState;
|
|
|
|
}
|
|
|
|
|
|
|
|
@riverpod
|
|
|
|
class LocalizationUIModel extends _$LocalizationUIModel {
|
2024-03-16 19:13:49 +08:00
|
|
|
static const languageSupport = {
|
|
|
|
"chinese_(simplified)": NoL10n.langZHS,
|
|
|
|
"chinese_(traditional)": NoL10n.langZHT,
|
2024-03-10 16:26:04 +08:00
|
|
|
};
|
|
|
|
|
2024-03-30 15:07:32 +08:00
|
|
|
Directory get _downloadDir =>
|
2024-03-10 16:26:04 +08:00
|
|
|
Directory("${appGlobalState.applicationSupportDir}\\Localizations");
|
|
|
|
|
2024-05-03 22:35:31 +08:00
|
|
|
Directory getDownloadDir() => _downloadDir;
|
|
|
|
|
2024-03-30 15:07:32 +08:00
|
|
|
Directory get _scDataDir =>
|
2024-03-10 16:26:04 +08:00
|
|
|
Directory("${ref.read(homeUIModelProvider).scInstalledPath}\\data");
|
|
|
|
|
2024-03-30 15:07:32 +08:00
|
|
|
File get _cfgFile => File("${_scDataDir.absolute.path}\\system.cfg");
|
2024-03-10 16:26:04 +08:00
|
|
|
|
|
|
|
StreamSubscription? _customizeDirListenSub;
|
|
|
|
|
|
|
|
String get _scInstallPath => ref.read(homeUIModelProvider).scInstalledPath!;
|
|
|
|
|
|
|
|
@override
|
|
|
|
LocalizationUIState build() {
|
|
|
|
state = LocalizationUIState(selectedLanguage: languageSupport.keys.first);
|
|
|
|
_init();
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2024-03-10 21:25:03 +08:00
|
|
|
Future<void> _init() async {
|
|
|
|
if (_scInstallPath == "not_install") {
|
|
|
|
return;
|
|
|
|
}
|
2024-03-10 16:26:04 +08:00
|
|
|
ref.onDispose(() {
|
|
|
|
_customizeDirListenSub?.cancel();
|
|
|
|
_customizeDirListenSub = null;
|
|
|
|
});
|
2024-03-17 17:19:37 +08:00
|
|
|
final appConfBox = await Hive.openBox("app_conf");
|
|
|
|
final lang = await appConfBox.get("localization_selectedLanguage",
|
|
|
|
defaultValue: languageSupport.keys.first);
|
|
|
|
state = state.copyWith(selectedLanguage: lang);
|
2024-03-10 21:25:03 +08:00
|
|
|
await _loadData();
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
|
2024-03-10 21:25:03 +08:00
|
|
|
final Map<String, Map<String, ScLocalizationData>>
|
|
|
|
_allVersionLocalizationData = {};
|
|
|
|
|
|
|
|
Future<void> _loadData() async {
|
|
|
|
_allVersionLocalizationData.clear();
|
2024-03-10 16:26:04 +08:00
|
|
|
await _updateStatus();
|
2024-03-10 21:25:03 +08:00
|
|
|
for (var lang in languageSupport.keys) {
|
|
|
|
final l = await Api.getScLocalizationData(lang).unwrap();
|
|
|
|
if (l != null) {
|
|
|
|
if (lang == state.selectedLanguage) {
|
|
|
|
final apiLocalizationData = <String, ScLocalizationData>{};
|
|
|
|
for (var element in l) {
|
|
|
|
final isPTU = !_scInstallPath.contains("LIVE");
|
|
|
|
if (isPTU && element.gameChannel == "PTU") {
|
|
|
|
apiLocalizationData[element.versionName ?? ""] = element;
|
|
|
|
} else if (!isPTU && element.gameChannel == "PU") {
|
|
|
|
apiLocalizationData[element.versionName ?? ""] = element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
state = state.copyWith(apiLocalizationData: apiLocalizationData);
|
|
|
|
}
|
|
|
|
final map = <String, ScLocalizationData>{};
|
|
|
|
for (var element in l) {
|
|
|
|
map[element.versionName ?? ""] = element;
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
2024-03-10 21:25:03 +08:00
|
|
|
_allVersionLocalizationData[lang] = map;
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void checkUserCfg(BuildContext context) async {
|
|
|
|
final userCfgFile = File("$_scInstallPath\\USER.cfg");
|
|
|
|
if (await userCfgFile.exists()) {
|
|
|
|
final cfgString = await userCfgFile.readAsString();
|
|
|
|
if (cfgString.contains("g_language") &&
|
|
|
|
!cfgString.contains("g_language=${state.selectedLanguage}")) {
|
|
|
|
if (!context.mounted) return;
|
|
|
|
final ok = await showConfirmDialogs(
|
|
|
|
context,
|
2024-03-15 00:01:06 +08:00
|
|
|
S.current.localization_info_remove_incompatible_translation_params,
|
2024-03-16 19:13:49 +08:00
|
|
|
Text(S.current
|
|
|
|
.localization_info_incompatible_translation_params_warning),
|
2024-03-10 16:26:04 +08:00
|
|
|
constraints: BoxConstraints(
|
|
|
|
maxWidth: MediaQuery.of(context).size.width * .35));
|
|
|
|
if (ok == true) {
|
|
|
|
var finalString = "";
|
|
|
|
for (var item in cfgString.split("\n")) {
|
|
|
|
if (!item.trim().startsWith("g_language")) {
|
|
|
|
finalString = "$finalString$item\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await userCfgFile.delete();
|
|
|
|
await userCfgFile.create();
|
|
|
|
await userCfgFile.writeAsString(finalString, flush: true);
|
|
|
|
_loadData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> updateLangCfg(bool enable) async {
|
|
|
|
final selectedLanguage = state.selectedLanguage!;
|
|
|
|
final status = await _getLangCfgEnableLang(lang: selectedLanguage);
|
2024-03-10 20:34:38 +08:00
|
|
|
final exists = await _cfgFile.exists();
|
2024-03-10 16:26:04 +08:00
|
|
|
if (status == enable) {
|
|
|
|
await _updateStatus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
StringBuffer newStr = StringBuffer();
|
|
|
|
var str = <String>[];
|
|
|
|
if (exists) {
|
2024-03-10 20:34:38 +08:00
|
|
|
str = (await _cfgFile.readAsString()).replaceAll(" ", "").split("\n");
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
if (enable) {
|
|
|
|
if (exists) {
|
|
|
|
for (var value in str) {
|
|
|
|
if (value.contains("sys_languages")) {
|
|
|
|
value = "sys_languages=$selectedLanguage";
|
|
|
|
} else if (value.contains("g_language")) {
|
|
|
|
value = "g_language=$selectedLanguage";
|
|
|
|
} else if (value.contains("g_languageAudio")) {
|
|
|
|
value = "g_language=english";
|
|
|
|
}
|
|
|
|
if (value.trim().isNotEmpty) newStr.writeln(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!newStr.toString().contains("sys_languages=$selectedLanguage")) {
|
|
|
|
newStr.writeln("sys_languages=$selectedLanguage");
|
|
|
|
}
|
|
|
|
if (!newStr.toString().contains("g_language=$selectedLanguage")) {
|
|
|
|
newStr.writeln("g_language=$selectedLanguage");
|
|
|
|
}
|
|
|
|
if (!newStr.toString().contains("g_languageAudio")) {
|
|
|
|
newStr.writeln("g_languageAudio=english");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (exists) {
|
|
|
|
for (var value in str) {
|
|
|
|
if (value.contains("sys_languages=")) {
|
|
|
|
continue;
|
|
|
|
} else if (value.contains("g_language")) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
newStr.writeln(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-10 20:34:38 +08:00
|
|
|
if (exists) await _cfgFile.delete(recursive: true);
|
|
|
|
await _cfgFile.create(recursive: true);
|
|
|
|
await _cfgFile.writeAsString(newStr.toString());
|
2024-03-10 16:26:04 +08:00
|
|
|
await _updateStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
void goFeedback() {
|
|
|
|
launchUrlString(URLConf.feedbackUrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
VoidCallback? doDelIniFile() {
|
|
|
|
return () async {
|
|
|
|
final iniFile = File(
|
2024-03-10 20:34:38 +08:00
|
|
|
"${_scDataDir.absolute.path}\\Localization\\${state.selectedLanguage}\\global.ini");
|
2024-03-10 16:26:04 +08:00
|
|
|
if (await iniFile.exists()) await iniFile.delete();
|
|
|
|
await updateLangCfg(false);
|
|
|
|
await _updateStatus();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void toggleCustomize() {
|
|
|
|
state = state.copyWith(enableCustomize: !state.enableCustomize);
|
|
|
|
}
|
|
|
|
|
|
|
|
String getCustomizeFileName(String path) {
|
|
|
|
return path.split("\\").last;
|
|
|
|
}
|
|
|
|
|
|
|
|
VoidCallback? doLocalInstall(String filePath) {
|
|
|
|
if (state.workingVersion.isNotEmpty) return null;
|
|
|
|
return () async {
|
|
|
|
final f = File(filePath);
|
|
|
|
if (!await f.exists()) return;
|
|
|
|
state = state.copyWith(workingVersion: filePath);
|
|
|
|
final str = await f.readAsString();
|
2024-05-05 14:59:07 +08:00
|
|
|
await installFormString(
|
2024-03-16 19:13:49 +08:00
|
|
|
StringBuffer(str),
|
|
|
|
S.current
|
|
|
|
.localization_info_custom_file(getCustomizeFileName(filePath)));
|
2024-03-10 16:26:04 +08:00
|
|
|
state = state.copyWith(workingVersion: "");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-05-05 14:59:07 +08:00
|
|
|
installFormString(StringBuffer globalIni, String versionName,
|
|
|
|
{bool? advanced}) async {
|
2024-03-10 16:26:04 +08:00
|
|
|
final iniFile = File(
|
2024-03-10 20:34:38 +08:00
|
|
|
"${_scDataDir.absolute.path}\\Localization\\${state.selectedLanguage}\\global.ini");
|
2024-03-10 16:26:04 +08:00
|
|
|
if (versionName.isNotEmpty) {
|
|
|
|
if (!globalIni.toString().endsWith("\n")) {
|
|
|
|
globalIni.write("\n");
|
|
|
|
}
|
2024-05-05 14:59:07 +08:00
|
|
|
if (advanced ?? false) {
|
|
|
|
globalIni.write("_starcitizen_doctor_localization_advanced=true\n");
|
|
|
|
}
|
|
|
|
globalIni
|
|
|
|
.write("_starcitizen_doctor_localization_version=$versionName\n");
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// write cfg
|
2024-03-10 20:34:38 +08:00
|
|
|
if (await _cfgFile.exists()) {}
|
2024-03-10 16:26:04 +08:00
|
|
|
|
|
|
|
/// write ini
|
|
|
|
if (await iniFile.exists()) {
|
|
|
|
await iniFile.delete();
|
|
|
|
}
|
|
|
|
await iniFile.create(recursive: true);
|
|
|
|
await iniFile.writeAsString("\uFEFF${globalIni.toString().trim()}",
|
|
|
|
flush: true);
|
|
|
|
await updateLangCfg(true);
|
|
|
|
await _updateStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
VoidCallback? doRemoteInstall(
|
|
|
|
BuildContext context, ScLocalizationData value) {
|
|
|
|
return () async {
|
|
|
|
AnalyticsApi.touch("install_localization");
|
2024-05-03 22:35:31 +08:00
|
|
|
|
2024-03-10 16:26:04 +08:00
|
|
|
final savePath =
|
|
|
|
File("${_downloadDir.absolute.path}\\${value.versionName}.sclang");
|
|
|
|
try {
|
|
|
|
state = state.copyWith(workingVersion: value.versionName!);
|
|
|
|
if (!await savePath.exists()) {
|
|
|
|
// download
|
2024-05-03 22:35:31 +08:00
|
|
|
await downloadLocalizationFile(savePath, value);
|
2024-03-10 16:26:04 +08:00
|
|
|
} else {
|
|
|
|
dPrint("use cache $savePath");
|
|
|
|
}
|
|
|
|
await Future.delayed(const Duration(milliseconds: 300));
|
|
|
|
// check file
|
2024-05-03 22:35:31 +08:00
|
|
|
final globalIni = await compute(readArchive, savePath.absolute.path);
|
2024-03-10 16:26:04 +08:00
|
|
|
if (globalIni.isEmpty) {
|
2024-03-15 00:01:06 +08:00
|
|
|
throw S.current.localization_info_corrupted_file;
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
2024-05-05 14:59:07 +08:00
|
|
|
await installFormString(globalIni, value.versionName ?? "");
|
2024-03-10 16:26:04 +08:00
|
|
|
} catch (e) {
|
|
|
|
if (!context.mounted) return;
|
2024-03-16 19:13:49 +08:00
|
|
|
await showToast(
|
|
|
|
context, S.current.localization_info_installation_error(e));
|
2024-03-10 16:26:04 +08:00
|
|
|
if (await savePath.exists()) await savePath.delete();
|
|
|
|
}
|
|
|
|
state = state.copyWith(workingVersion: "");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-05-03 22:35:31 +08:00
|
|
|
Future<void> downloadLocalizationFile(
|
|
|
|
File savePath, ScLocalizationData value) async {
|
|
|
|
dPrint("downloading file to $savePath");
|
|
|
|
final downloadUrl =
|
|
|
|
"${URLConf.gitlabLocalizationUrl}/archive/${value.versionName}.tar.gz";
|
|
|
|
final r = await RSHttp.get(downloadUrl);
|
|
|
|
if (r.statusCode == 200 && r.data != null) {
|
|
|
|
await savePath.writeAsBytes(r.data!);
|
|
|
|
} else {
|
|
|
|
throw "statusCode Error : ${r.statusCode}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static StringBuffer readArchive(String savePath) {
|
2024-03-10 16:26:04 +08:00
|
|
|
final inputStream = InputFileStream(savePath);
|
|
|
|
final archive =
|
|
|
|
TarDecoder().decodeBytes(GZipDecoder().decodeBuffer(inputStream));
|
|
|
|
StringBuffer globalIni = StringBuffer("");
|
|
|
|
for (var element in archive.files) {
|
|
|
|
if (element.name.contains("global.ini")) {
|
|
|
|
for (var value
|
|
|
|
in (element.rawContent?.readString() ?? "").split("\n")) {
|
|
|
|
final tv = value.trim();
|
|
|
|
if (tv.isNotEmpty) globalIni.writeln(tv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
archive.clear();
|
|
|
|
return globalIni;
|
|
|
|
}
|
|
|
|
|
|
|
|
String? getScInstallPath() {
|
|
|
|
return ref.read(homeUIModelProvider).scInstalledPath;
|
|
|
|
}
|
|
|
|
|
2024-03-17 17:19:37 +08:00
|
|
|
void selectLang(String v) async {
|
2024-03-10 16:26:04 +08:00
|
|
|
state = state.copyWith(selectedLanguage: v);
|
|
|
|
_loadData();
|
2024-03-17 17:19:37 +08:00
|
|
|
final appConfBox = await Hive.openBox("app_conf");
|
|
|
|
await appConfBox.put("localization_selectedLanguage", v);
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
VoidCallback? onBack(BuildContext context) {
|
|
|
|
if (state.workingVersion.isNotEmpty) return null;
|
|
|
|
return () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
VoidCallback? doRefresh() {
|
|
|
|
if (state.workingVersion.isNotEmpty) return null;
|
|
|
|
return () {
|
|
|
|
state = state.copyWith(apiLocalizationData: null);
|
|
|
|
_loadData();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
_updateStatus() async {
|
|
|
|
final patchStatus = MapEntry(
|
|
|
|
await _getLangCfgEnableLang(lang: state.selectedLanguage!),
|
|
|
|
await _getInstalledIniVersion(
|
2024-03-10 20:34:38 +08:00
|
|
|
"${_scDataDir.absolute.path}\\Localization\\${state.selectedLanguage}\\global.ini"));
|
2024-05-05 14:59:07 +08:00
|
|
|
final isInstalledAdvanced = await _checkAdvancedStatus(
|
|
|
|
"${_scDataDir.absolute.path}\\Localization\\${state.selectedLanguage}\\global.ini");
|
|
|
|
state = state.copyWith(
|
|
|
|
patchStatus: patchStatus, isInstalledAdvanced: isInstalledAdvanced);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<bool> _checkAdvancedStatus(String path) async {
|
|
|
|
final iniFile = File(path);
|
|
|
|
if (!await iniFile.exists()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
final iniString = (await iniFile.readAsString());
|
|
|
|
return iniString.contains("_starcitizen_doctor_localization_advanced=true");
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<bool> _getLangCfgEnableLang({String lang = ""}) async {
|
2024-03-10 20:34:38 +08:00
|
|
|
if (!await _cfgFile.exists()) return false;
|
|
|
|
final str = (await _cfgFile.readAsString()).replaceAll(" ", "");
|
2024-03-10 16:26:04 +08:00
|
|
|
return str.contains("sys_languages=$lang") &&
|
|
|
|
str.contains("g_language=$lang") &&
|
|
|
|
str.contains("g_languageAudio=english");
|
|
|
|
}
|
|
|
|
|
|
|
|
static Future<String> _getInstalledIniVersion(String iniPath) async {
|
|
|
|
final iniFile = File(iniPath);
|
2024-03-16 19:13:49 +08:00
|
|
|
if (!await iniFile.exists()) {
|
|
|
|
return S.current.home_action_info_game_built_in;
|
|
|
|
}
|
2024-03-10 16:26:04 +08:00
|
|
|
final iniStringSplit = (await iniFile.readAsString()).split("\n");
|
|
|
|
for (var i = iniStringSplit.length - 1; i > 0; i--) {
|
|
|
|
if (iniStringSplit[i]
|
|
|
|
.contains("_starcitizen_doctor_localization_version=")) {
|
|
|
|
final v = iniStringSplit[i]
|
|
|
|
.trim()
|
|
|
|
.split("_starcitizen_doctor_localization_version=")[1];
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
}
|
2024-03-15 00:01:06 +08:00
|
|
|
return S.current.localization_info_custom_files;
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
|
|
|
|
2024-03-10 21:25:03 +08:00
|
|
|
Future<List<String>> checkLangUpdate({bool skipReload = false}) async {
|
|
|
|
if (_scInstallPath == "not_install") {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
if (!skipReload || (state.apiLocalizationData?.isEmpty ?? true)) {
|
|
|
|
await _init();
|
|
|
|
}
|
2024-03-10 20:34:38 +08:00
|
|
|
|
2024-03-10 21:25:03 +08:00
|
|
|
final homeState = ref.read(homeUIModelProvider);
|
|
|
|
if (homeState.scInstallPaths.isEmpty) return [];
|
|
|
|
|
|
|
|
List<String> updates = [];
|
|
|
|
|
|
|
|
for (var scInstallPath in homeState.scInstallPaths) {
|
|
|
|
// 读取游戏安装文件夹
|
|
|
|
final scDataDir = Directory("$scInstallPath\\data\\Localization");
|
|
|
|
// 扫描目录确认已安装的语言
|
|
|
|
final dirList = await scDataDir.list().toList();
|
|
|
|
for (var element in dirList) {
|
|
|
|
for (var lang in languageSupport.keys) {
|
|
|
|
if (element.path.contains(lang)) {
|
|
|
|
final installedVersion =
|
|
|
|
await _getInstalledIniVersion("${element.path}\\global.ini");
|
2024-04-12 20:09:16 +08:00
|
|
|
if (installedVersion == S.current.home_action_info_game_built_in ||
|
|
|
|
installedVersion == S.current.localization_info_custom_files) {
|
2024-03-16 19:13:49 +08:00
|
|
|
continue;
|
|
|
|
}
|
2024-03-10 21:25:03 +08:00
|
|
|
final curData = _allVersionLocalizationData[lang];
|
|
|
|
dPrint("check Localization update $scInstallPath");
|
|
|
|
if (!(curData?.keys.contains(installedVersion) ?? false)) {
|
|
|
|
// has update
|
|
|
|
for (var channel in ConstConf.gameChannels) {
|
|
|
|
if (scInstallPath.contains(channel)) {
|
|
|
|
dPrint("check Localization update: has update -> $channel");
|
|
|
|
updates.add(channel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dPrint("check Localization update: up to date");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return updates;
|
2024-03-10 16:26:04 +08:00
|
|
|
}
|
2024-03-16 19:13:49 +08:00
|
|
|
}
|