From 4db3692de0001eea35f938c1224181746e72933a Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 27 十一月 2025 21:30:07 +0800
Subject: [PATCH] 支持创建阿拉伯语言的脚本文件夹
---
app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java | 96 ++++++++++++++++++------------------------------
1 files changed, 36 insertions(+), 60 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
index c476bb2..4f91804 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlFileLogic.java
@@ -10,6 +10,8 @@
import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.config.UserConfigManage;
+import com.hdl.photovoltaic.enums.Languages;
+import com.hdl.photovoltaic.ui.adapter.LanguageAdapter;
import com.hdl.photovoltaic.utils.LocalManageUtil;
import org.apache.commons.io.FileUtils;
@@ -23,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.util.List;
import java.util.Objects;
/**
@@ -87,7 +90,7 @@
}
/**
- * 鑾峰彇瀛樻斁銆愰┍鍔ㄦ枃浠跺す銆戞牴璺緞
+ * 鑾峰彇瀛樻斁椹卞姩銆愭枃浠跺す銆戞牴璺緞
*/
public String getDriveRootPath() {
return getAPPInternalStoreFilesPath() + "/upgrade/drive";
@@ -95,33 +98,26 @@
/**
- * 鑾峰彇瀛樻斁銆愬浐浠舵枃浠跺す銆戞牴璺緞
+ * 鑾峰彇瀛樻斁鍥轰欢銆愭枃浠跺す銆戞牴璺緞
*/
public String getFirmwareRootPath() {
return getAPPInternalStoreFilesPath() + "/upgrade/firmware";
}
- /**
- * 鑾峰彇涓枃銆恓son璧勬簮鏂囦欢澶广�戝叏璺緞
- *
- * @param deviceModel 璁惧鍨嬪彿
- */
- public String getHdlESLocalJsonZhRootPath(String deviceModel) {
- return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + LocalManageUtil.zh + "/" + deviceModel;
- }
/**
- * 鑾峰彇鑻辨枃銆恓son璧勬簮鏂囦欢澶广�戝叏璺緞
+ * 鑾峰彇json璧勬簮銆愭枃浠跺す銆戝叏璺緞
*
+ * @param language 璇█ 閫氳繃鏋氫妇绫籐anguages.en鑾峰彇
* @param deviceModel 璁惧鍨嬪彿
*/
- public String getHdlESLocalJsonEnRootPath(String deviceModel) {
- return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + LocalManageUtil.en + "/" + deviceModel;
+ public String getHdlESLocalJsonRootPath(String language, String deviceModel) {
+ return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + language + "/" + deviceModel;
}
/**
- * 鑾峰彇銆愭棩蹇楁枃浠躲�戝叏璺緞
+ * 鑾峰彇鏃ュ織銆愭枃浠躲�戝叏璺緞
*/
public String getLogFileNamePath() {
return getCurrentHomeRootPath() + "/log.txt";
@@ -129,35 +125,28 @@
/**
- * 鑾峰彇銆愮敤鎴锋枃浠躲�戝叏璺緞
+ * 鑾峰彇鐢ㄦ埛銆愭枃浠躲�戝叏璺緞
*/
public String getUserFilePath() {
return getAPPInternalStoreFilesPath() + "/userConfigManage.txt";
}
/**
- * 鑾峰彇涓枃銆恓son璧勬簮鏂囦欢銆戝叏璺緞
+ * 鑾峰彇鏈湴璇█json璧勬簮銆愭枃浠躲�戝叏璺緞
+ *
+ * @param language 璇█ 閫氳繃鏋氫妇绫籐anguages.en鑾峰彇
+ * @param deviceModel 璁惧鍨嬪彿
+ * @param fileName 鏂囦欢鍚�
*/
- public String getHdlESLocalJsonZhFilePath(String deviceModel, String fileName) {
+ public String getHdlESLocalLanguageJsonFilePath(String language, String deviceModel, String fileName) {
if (!fileName.endsWith(".json")) {
fileName += ".json";
}
- return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + LocalManageUtil.zh + "/" + deviceModel + "/" + fileName;
+ return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + language + "/" + deviceModel + "/" + fileName;
}
/**
- * 鑾峰彇鑻辨枃銆恓son璧勬簮鏂囦欢銆戝叏璺緞
- */
- public String getHdlESLocalJsonEnFilePath(String deviceModel, String fileName) {
- if (!fileName.endsWith(".json")) {
- fileName += ".json";
- }
- return getAPPInternalStoreFilesPath() + "/hdlESLocalJson/" + LocalManageUtil.en + "/" + deviceModel + "/" + fileName;
- }
-
-
- /**
- * 鑾峰彇椹卞姩鍗囩骇鏂囦欢鍏ㄨ矾寰�
+ * 鑾峰彇椹卞姩鍗囩骇銆愭枃浠躲�戝叏璺緞
*
* @param driverCode 椹卞姩缂栫爜
* @param version 椹卞姩鐗堟湰
@@ -169,7 +158,7 @@
}
/**
- * 鑾峰彇鍥轰欢鍗囩骇鏂囦欢鍏ㄨ矾寰�
+ * 鑾峰彇鍥轰欢鍗囩骇銆愭枃浠躲�戝叏璺緞
*
* @param imageId 闀滃儚id
* @param version 椹卞姩鐗堟湰
@@ -185,7 +174,7 @@
//region ---------銆愭枃浠跺す銆戞搷浣�-----------
/**
- * 棰勫垱寤烘枃浠跺す
+ * 棰勫垱寤恒�愭枃浠跺す銆�
*/
public void createDirectory() {
//瀛樻斁浣忓畢淇℃伅
@@ -194,39 +183,26 @@
this.createFileDir(this.getDriveRootPath());
//鍥轰欢鏂囦欢
this.createFileDir(this.getFirmwareRootPath());
-
}
/**
- * 棰勫垱寤簀son璧勬簮鏂囦欢澶�
+ * 棰勫垱寤鸿澶噅son璧勬簮銆愭枃浠跺す銆�
*/
- public void createHdlESLocalJsonDirectory() {
- //涓枃鏂囦欢澶�
-
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.INV));//閫嗗彉鍣�
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.LC));//璐熻浇涓績
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.INV_BMS));//BMS
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.INV_BATTERY));//鐢垫睜鍖�
- //绂荤嚎閫嗗彉鍣�
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV));//绂荤嚎閫嗗彉鍣�
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV_BMS));//绂荤綉閫嗗彉鍣ㄨ櫄鎷烞MS
- this.createFileDir(this.getHdlESLocalJsonZhRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV_BATTERY));//绂荤綉閫嗗彉鍣ㄧ數姹犲寘
-
-
- //鑻辨枃鏂囦欢澶�
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.INV));
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.LC));
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.INV_BMS));
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.INV_BATTERY));
- //绂荤嚎閫嗗彉鍣�
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV));//绂荤嚎閫嗗彉鍣�
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV_BMS));//绂荤綉閫嗗彉鍣ㄨ櫄鎷烞MS
- this.createFileDir(this.getHdlESLocalJsonEnRootPath(HdlESLocalJsonLogic.DeviceModel.OFF_INV_BATTERY));//绂荤綉閫嗗彉鍣ㄧ數姹犲寘
+ public void createHdlDeviceModelLocalJsonDirectory() {
+ List<LanguageAdapter.ItemData> languageList = LocalManageUtil.getLanguageList();
+ List<String> deviceModelList = HdlESLocalJsonLogic.getInstance().getModelList();
+ for (int i = 0; i < languageList.size(); i++) {
+ LanguageAdapter.ItemData languageModel = languageList.get(i);
+ for (int j = 0; j < deviceModelList.size(); j++) {
+ String deviceModel = deviceModelList.get(j);
+ this.createFileDir(this.getHdlESLocalJsonRootPath(languageModel.getLanguage(), deviceModel));//骞剁綉-閫嗗彉鍣�
+ }
+ }
}
/**
- * 鍒涘缓鏂囦欢澶�
+ * 鍒涘缓銆愭枃浠跺す銆�
*
* @param fullPath fullPath 鍏ㄨ矾寰�
* @return -
@@ -248,7 +224,7 @@
/**
- * 鍒犻櫎鏂囦欢澶�
+ * 鍒犻櫎銆愭枃浠跺す銆�
*
* @param fullPath 鍏ㄨ矾寰�
*/
@@ -282,7 +258,7 @@
//region ---------銆愭枃浠躲�戞搷浣�-----------
/**
- * 鍒涘缓鏂囦欢
+ * 鍒涘缓銆愭枃浠躲��
*
* @param fullPath 鍏ㄨ矾寰�
* @return -
@@ -303,7 +279,7 @@
}
/**
- * 鍒犻櫎鏂囦欢
+ * 鍒犻櫎銆愭枃浠躲��
*
* @param fullPath 鍏ㄨ矾寰�
* @return -
--
Gitblit v1.8.0