| | |
| | | import android.util.Log; |
| | | |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.BufferedOutputStream; |
| | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 文件界面的逻辑 |
| | | * 文件的逻辑 |
| | | */ |
| | | public class HdlFileLogic { |
| | | |
| | |
| | | |
| | | private static final String TAG = "FileUtils"; |
| | | |
| | | public static final String userId = ""; |
| | | private String getUserId() { |
| | | return UserConfigManage.getInstance().getUserId(); |
| | | } |
| | | |
| | | private String getHomeId() { |
| | | return UserConfigManage.getInstance().getHomeId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取内部存储文件路径 |
| | | * 获取手机内部存储文件路径 |
| | | */ |
| | | private String getInternalStoreFilesPath() { |
| | | private String getAPPInternalStoreFilesPath() { |
| | | return HDLApp.getInstance().getFilesDir().getAbsolutePath(); |
| | | } |
| | | |
| | | /** |
| | | * 获取App存放文件的根路径 |
| | | * 获取存放文件用户根路径 |
| | | */ |
| | | public String getAppFilesPath() { |
| | | return HDLApp.getInstance().getFilesDir().getAbsolutePath() + userId + "/home"; |
| | | public String getUserFilesPath() { |
| | | return HDLApp.getInstance().getFilesDir().getAbsolutePath() + getUserId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取存放文件住宅根路径 |
| | | */ |
| | | public String getHomeFilesPath() { |
| | | return HDLApp.getInstance().getFilesDir().getAbsolutePath() + getUserId() + "/home"; |
| | | } |
| | | |
| | | /** |
| | | * 住宅名称 |
| | | * |
| | | * @return - |
| | | */ |
| | | public String getHomeFileName() { |
| | | return getHomeId() + ".json"; |
| | | } |
| | | |
| | | public File createFile(String dirPath, String fileName) { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 预创建文件夹 |
| | | */ |
| | | public void createDirectory() { |
| | | //用户信息 |
| | | this.createFileDir(new File(this.getUserFilesPath())); |
| | | //住宅信息 |
| | | this.createFileDir(new File(this.getHomeFilesPath())); |
| | | } |
| | | } |