| | |
| | | this.idleTrailDurationSeconds = durationSeconds; |
| | | value = String.valueOf(durationSeconds); |
| | | break; |
| | | case "mapScale": |
| | | // mapScale不需要在内存中存储,直接更新到文件 |
| | | break; |
| | | default: |
| | | System.err.println("未知的属性名: " + propertyName); |
| | | return false; |
| | | // 对于其他属性,也允许直接更新到文件(不打印错误) |
| | | break; |
| | | } |
| | | |
| | | // 更新properties文件 |
| | |
| | | // 写回文件 |
| | | try (FileOutputStream output = new FileOutputStream(PROPERTIES_FILE)) { |
| | | props.store(output, "Mower Configuration Properties - Updated"); |
| | | System.out.println("属性 " + propertyName + " 已更新为: " + value); |
| | | return true; |
| | | } catch (IOException e) { |
| | | System.err.println("更新属性文件失败: " + e.getMessage()); |