| | |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | import dialog.Dingshidialog; |
| | | import dialog.Errlog; |
| | | import home.MachineConfig; |
| | | |
| | | /** |
| | |
| | | |
| | | return true; |
| | | } catch (Exception e) { |
| | | System.err.println("系统初始化异常: " + e.getMessage()); |
| | | Errlog.logOperation("系统初始化异常: " + e.getMessage()); |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | |
| | | ////System.out.println("系统关闭:轮询查询已停止"); |
| | | } |
| | | } catch (Exception e) { |
| | | System.err.println("系统关闭异常: " + e.getMessage()); |
| | | Errlog.logOperation("系统关闭异常: " + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | // 检查配置文件是否存在 |
| | | File configFile = new File(configFilePath); |
| | | if (!configFile.exists()) { |
| | | System.err.println("配置文件不存在: " + configFilePath); |
| | | Errlog.logOperation("配置文件不存在: " + configFilePath); |
| | | return false; |
| | | } |
| | | |
| | |
| | | return true; |
| | | |
| | | } catch (Exception e) { |
| | | System.err.println("系统初始化失败: " + e.getMessage()); |
| | | Errlog.logOperation("系统初始化失败: " + e.getMessage()); |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public boolean saveConfig(String configFilePath) { |
| | | if (machineConfig == null) { |
| | | System.err.println("配置未加载,无法保存"); |
| | | Errlog.logOperation("配置未加载,无法保存"); |
| | | return false; |
| | | } |
| | | |
| | |
| | | ////System.out.println("配置已保存到: " + configFilePath); |
| | | return true; |
| | | } catch (Exception e) { |
| | | System.err.println("保存配置失败: " + e.getMessage()); |
| | | Errlog.logOperation("保存配置失败: " + e.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public MachineConfig getMachineConfig() { |
| | | if (!initialized) { |
| | | throw new IllegalStateException("系统未初始化,请先调用initialize()方法"); |
| | | Dingshidialog.showTimedDialog(null,10,"系统未初始化成功"); |
| | | } |
| | | return machineConfig; |
| | | } |