diff --git a/build.xml b/build.xml index 171ff5c..69f8d9b 100644 --- a/build.xml +++ b/build.xml @@ -10,6 +10,30 @@ Builds, tests, and runs the project ESPSFlashTool. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/forkineye/espsflashtool/ESPSFlashToolUI.java b/src/com/forkineye/espsflashtool/ESPSFlashToolUI.java index 9e77012..6f1c599 100644 --- a/src/com/forkineye/espsflashtool/ESPSFlashToolUI.java +++ b/src/com/forkineye/espsflashtool/ESPSFlashToolUI.java @@ -24,6 +24,7 @@ import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.DefaultComboBoxModel; @@ -51,6 +52,8 @@ public class ESPSFlashToolUI extends javax.swing.JFrame private SerialPort lastPort; + private Properties properties = new Properties(); + /** * Creates new form ESPSFlashToolUI */ @@ -66,6 +69,13 @@ public void init() } catch( Exception ex ) { System.err.println( "Failed to initialize LaF" ); } + + try { + properties.load( Thread.currentThread().getContextClassLoader().getResourceAsStream( "com/forkineye/espsflashtool/espsflashtool.properties" ) ); + System.out.println(" Version: " + properties.get( "application.version" ) ); + } catch( Exception ex ) { + System.err.println( "Failed to load properties" ); + } // Netbeans init routine initComponents(); @@ -375,7 +385,7 @@ private void initComponents() { ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("ESPixelStick Flash Tool"); + setTitle("ESPixelStick Flash Tool - " + properties.get( "application.version" ) ); setIconImage(Toolkit.getDefaultToolkit().getImage(ESPSFlashToolUI.class.getResource("Forkineye-icon32.png"))); lblRelease.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N @@ -876,6 +886,7 @@ private void jButtonSaveLogsActionPerformed(java.awt.event.ActionEvent evt)//GEN File LogFilePath = LogFileChooser.getSelectedFile(); try ( FileWriter LogFileWriter = new FileWriter(LogFilePath, false)) { + LogFileWriter.write("ESPSFlashTool Version: " + properties.get( "application.version" ) + "\n\n" ); LogFileWriter.write("System Output: \n\n"); LogFileWriter.write(txtSystemOutput.getText()); LogFileWriter.write("\n\nSerial Output: \n\n"); diff --git a/src/com/forkineye/espsflashtool/espsflashtool.properties b/src/com/forkineye/espsflashtool/espsflashtool.properties new file mode 100644 index 0000000..97777df --- /dev/null +++ b/src/com/forkineye/espsflashtool/espsflashtool.properties @@ -0,0 +1,19 @@ +#Sun, 05 Feb 2023 08:42:05 -0500 +# Copyright 2023 smore. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +build.date=20230205 +git.revision=efbffab +application.version=20230205-efbffab