From 125bf878f01d2615076bb238ea035581dc8642af Mon Sep 17 00:00:00 2001 From: Dennis Turco Date: Wed, 6 Nov 2024 22:22:58 +0100 Subject: [PATCH] feat: junit --- .github/workflows/maven.yml | 39 +- nullnull | 52 + pom.xml | 16 + .../autobackupprogram/BackupManagerGUI.java | 2979 +++++++++-------- .../autobackupprogram/BackupOperations.java | 6 + .../autobackupprogram/FileCopyListener.java | 5 - .../autobackupprogram/TimePicker.java | 22 +- .../TreeCopyFileVisitor.java | 65 - src/main/resources/res/backup_list.json | 2 +- src/main/resources/res/log_file | 1084 +----- src/test/java/test/AutoBackupProgramTest.java | 136 - src/test/java/test/TestBackupManagerGUI.java | 21 + src/test/java/test/TestConfigKey.java | 141 + src/test/java/test/TestLogger.java | 139 + src/test/resources/config_test.json | 3 + 15 files changed, 1906 insertions(+), 2804 deletions(-) create mode 100644 nullnull delete mode 100644 src/main/java/com/mycompany/autobackupprogram/FileCopyListener.java delete mode 100644 src/main/java/com/mycompany/autobackupprogram/TreeCopyFileVisitor.java delete mode 100644 src/test/java/test/AutoBackupProgramTest.java create mode 100644 src/test/java/test/TestBackupManagerGUI.java create mode 100644 src/test/java/test/TestConfigKey.java create mode 100644 src/test/java/test/TestLogger.java create mode 100644 src/test/resources/config_test.json diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index b633f57..5e5a922 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -10,45 +10,46 @@ name: Java CI with Maven on: push: - branches: [ "master" ] + branches: [ "master" ] # Trigger the action on push to the master branch pull_request: - branches: [ "master" ] + branches: [ "master" ] # Trigger the action on pull requests targeting the master branch jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # Use the latest version of Ubuntu for the build environment steps: - # Check out the code from the repository - - uses: actions/checkout@v4 + # Step 1: Check out the code from the repository + - name: Check out code + uses: actions/checkout@v4 - # Set up JDK 19 + # Step 2: Set up JDK 19 - name: Set up JDK 19 uses: actions/setup-java@v4 with: java-version: '19' - distribution: 'temurin' - cache: maven + distribution: 'temurin' # Use the Temurin distribution for OpenJDK + cache: maven # Cache Maven dependencies to speed up subsequent builds - # Clean and build with Maven + # Step 3: Clean and build with Maven - name: Build with Maven - run: mvn -B clean package --file pom.xml + run: mvn -B clean package --file pom.xml # Build the project with Maven, suppress the interactive mode - # Run tests to ensure code quality + # Step 4: Run Tests - name: Run Tests - run: mvn test --file pom.xml + run: mvn test --file pom.xml # Run the tests to ensure the code works as expected - # Upload the built JAR file as an artifact + # Step 5: Upload the built JAR file as an artifact - name: Upload JAR Artifact uses: actions/upload-artifact@v3 with: - name: backupmanager-jar - path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar + name: backupmanager-jar # Name of the artifact + path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar # Path to the JAR file - # Run static code analysis with SpotBugs (optional, requires SpotBugs plugin in POM) + # Step 6: Static Code Analysis with SpotBugs (optional) - name: Static Code Analysis with SpotBugs - run: mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs + run: mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs # Run SpotBugs for static code analysis - # Update dependency graph to improve Dependabot alerts + # Step 7: Update dependency graph to improve Dependabot alerts - name: Update dependency graph - uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 # Submit dependency graph for security monitoring \ No newline at end of file diff --git a/nullnull b/nullnull new file mode 100644 index 0000000..a0e4449 --- /dev/null +++ b/nullnull @@ -0,0 +1,52 @@ +2024-11-06T22:02:09.732789100 [INFO] Test info message +2024-11-06T21:54:56.764714600 [INFO] Test info message + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) + at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) + at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) + at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) + at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) + at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) + at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) + at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) + at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) + at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56) + at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184) + at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148) + at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) + at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) + at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) diff --git a/pom.xml b/pom.xml index 43a8463..6242a5f 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,22 @@ test + + + org.junit.jupiter + junit-jupiter-engine + 5.8.1 + test + + + + + org.mockito + mockito-core + 4.0.0 + test + + com.formdev diff --git a/src/main/java/com/mycompany/autobackupprogram/BackupManagerGUI.java b/src/main/java/com/mycompany/autobackupprogram/BackupManagerGUI.java index 986569c..3af6529 100644 --- a/src/main/java/com/mycompany/autobackupprogram/BackupManagerGUI.java +++ b/src/main/java/com/mycompany/autobackupprogram/BackupManagerGUI.java @@ -25,6 +25,7 @@ import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.JTextField; +import static javax.swing.SwingConstants.CENTER; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -120,1725 +121,1725 @@ public void showWindow() { toFront(); requestFocus(); } + + private TimeInterval openTimePicker(TimeInterval time) { + TimePicker picker = new TimePicker(this, time, true); + picker.setVisible(true); + return picker.getTimeInterval(); + } + + private void renameBackup(Backup backup) { + Logger.logMessage("Event --> backup renaming", Logger.LogLevel.INFO); + + String backup_name = getBackupName(false); + if (backup_name == null || backup_name.isEmpty()) return; + + backup.setBackupName(backup_name); + backup.setLastUpdateDate(LocalDateTime.now()); + BackupOperations.updateBackupList(backups); + } + + private void OpenFolder(String path) { + Logger.logMessage("Event --> opening folder", Logger.LogLevel.INFO); + + File folder = new File(path); + if (folder.exists() && folder.isDirectory()) { + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); + try { + desktop.open(folder); + } catch (IOException ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } + } else { + Logger.logMessage("Desktop not supported on this operating system", Logger.LogLevel.WARN); + } + } else { + Logger.logMessage("The folder does not exist or is invalid", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "The folder does not exist or is invalid", "Error", JOptionPane.ERROR_MESSAGE); + } + } + + private void savedChanges(boolean saved) { + if (saved || currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty() || (currentBackup.getInitialPath().equals(startPathField.getText())) && currentBackup.getDestinationPath().equals(destinationPathField.getText()) && currentBackup.getNotes().equals(backupNoteTextArea.getText())) { + setCurrentBackupName(currentBackup.getBackupName()); + } else { + setCurrentBackupName(currentBackup.getBackupName() + "*"); + } + saveChanged = saved; + } + + public void setAutoBackupPreference(boolean option) { + toggleAutoBackup.setSelected(option); + toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); + currentBackup.setAutoBackup(option); + + if (!option) { + disableAutoBackup(currentBackup); + } + } + + public void setAutoBackupPreference(Backup backup, boolean option) { + backup.setAutoBackup(option); + if (backup.getBackupName().equals(currentBackup.getBackupName())) { + toggleAutoBackup.setSelected(option); + } + if (!option) { + disableAutoBackup(backup); + } + toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); + } + + // it returns true if is correctly setted, false otherwise + public boolean AutomaticBackup() { + Logger.logMessage("Event --> automatic backup", Logger.LogLevel.INFO); + + if(!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(),startPathField.getText(), destinationPathField.getText(), null)) return false; - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; + // if the file has not been saved you need to save it before setting the auto backup + if(currentBackup.isAutoBackup() == false || currentBackup.getNextDateBackup() == null || currentBackup.getTimeIntervalBackup() == null) { + if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) SaveWithName(); + if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) return false; - TablePopup = new javax.swing.JPopupMenu(); - EditPoputItem = new javax.swing.JMenuItem(); - DeletePopupItem = new javax.swing.JMenuItem(); - DuplicatePopupItem = new javax.swing.JMenuItem(); - renamePopupItem = new javax.swing.JMenuItem(); - jSeparator1 = new javax.swing.JPopupMenu.Separator(); - OpenInitialFolderItem = new javax.swing.JMenuItem(); - OpenInitialDestinationItem = new javax.swing.JMenuItem(); - jSeparator3 = new javax.swing.JPopupMenu.Separator(); - Backup = new javax.swing.JMenu(); - RunBackupPopupItem = new javax.swing.JMenuItem(); - AutoBackupMenuItem = new javax.swing.JCheckBoxMenuItem(); - jSeparator2 = new javax.swing.JPopupMenu.Separator(); - jMenu4 = new javax.swing.JMenu(); - CopyBackupNamePopupItem = new javax.swing.JMenuItem(); - CopyInitialPathPopupItem = new javax.swing.JMenuItem(); - CopyDestinationPathPopupItem = new javax.swing.JMenuItem(); - TabbedPane = new javax.swing.JTabbedPane(); - jPanel1 = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); - txtTitle = new javax.swing.JLabel(); - currentFileLabel = new javax.swing.JLabel(); - startPathField = new javax.swing.JTextField(); - btnPathSearch1 = new javax.swing.JButton(); - destinationPathField = new javax.swing.JTextField(); - btnPathSearch2 = new javax.swing.JButton(); - lastBackupLabel = new javax.swing.JLabel(); - SingleBackup = new javax.swing.JButton(); - jScrollPane2 = new javax.swing.JScrollPane(); - backupNoteTextArea = new javax.swing.JTextArea(); - jLabel2 = new javax.swing.JLabel(); - btnTimePicker = new javax.swing.JButton(); - toggleAutoBackup = new javax.swing.JToggleButton(); - filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0)); - jPanel3 = new javax.swing.JPanel(); - jPanel4 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - tablePanel = new javax.swing.JPanel(); - addBackupEntryButton = new javax.swing.JButton(); - jScrollPane1 = new javax.swing.JScrollPane(); - table = new javax.swing.JTable(); - jLabel1 = new javax.swing.JLabel(); - researchField = new javax.swing.JTextField(); - detailsPanel = new javax.swing.JPanel(); - detailsLabel = new javax.swing.JLabel(); - jLabel3 = new javax.swing.JLabel(); - jMenuBar1 = new javax.swing.JMenuBar(); - jMenu1 = new javax.swing.JMenu(); - MenuNew = new javax.swing.JMenuItem(); - MenuSave = new javax.swing.JMenuItem(); - MenuSaveWithName = new javax.swing.JMenuItem(); - MenuClear = new javax.swing.JMenuItem(); - MenuHistory = new javax.swing.JMenuItem(); - jMenu2 = new javax.swing.JMenu(); - MenuBugReport = new javax.swing.JMenuItem(); - MenuQuit = new javax.swing.JMenuItem(); - jMenu3 = new javax.swing.JMenu(); - MenuShare = new javax.swing.JMenuItem(); - MenuDonate = new javax.swing.JMenuItem(); - MenuInfoPage = new javax.swing.JMenuItem(); - jMenu5 = new javax.swing.JMenu(); - MenuWebsite = new javax.swing.JMenuItem(); - MenuSupport = new javax.swing.JMenuItem(); + // message + TimeInterval timeInterval = openTimePicker(null); + if (timeInterval == null) return false; - EditPoputItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/pen.png"))); // NOI18N - EditPoputItem.setText("Edit"); - EditPoputItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - EditPoputItemActionPerformed(evt); - } - }); - TablePopup.add(EditPoputItem); + //set date for next backup + LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) + .plusHours(timeInterval.getHours()) + .plusMinutes(timeInterval.getMinutes()); - DeletePopupItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/bin.png"))); // NOI18N - DeletePopupItem.setText("Delete"); - DeletePopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - DeletePopupItemActionPerformed(evt); - } - }); - TablePopup.add(DeletePopupItem); + currentBackup.setTimeIntervalBackup(timeInterval); + currentBackup.setNextDateBackup(nextDateBackup); + btnTimePicker.setToolTipText(timeInterval.toString()); + btnTimePicker.setEnabled(true); - DuplicatePopupItem.setText("Duplicate"); - DuplicatePopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - DuplicatePopupItemActionPerformed(evt); - } - }); - TablePopup.add(DuplicatePopupItem); + Logger.logMessage("Event --> Next date backup setted to " + nextDateBackup, Logger.LogLevel.INFO); + JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + startPathField.getText() + "\n\tTo: " + destinationPathField.getText() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); + } - renamePopupItem.setText("Rename backup"); - renamePopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - renamePopupItemActionPerformed(evt); + currentBackup.setInitialPath(GetStartPathField()); + currentBackup.setDestinationPath(GetDestinationPathField()); + for (Backup b : backups) { + if (b.getBackupName().equals(currentBackup.getBackupName())) { + b.UpdateBackup(currentBackup); + break; } - }); - TablePopup.add(renamePopupItem); - TablePopup.add(jSeparator1); + } + BackupOperations.updateBackupList(backups); + return true; + } + + public boolean AutomaticBackup(Backup backup) { + Logger.logMessage("Event --> automatic backup", Logger.LogLevel.INFO); + + if(!BackupOperations.CheckInputCorrect(backup.getBackupName(), backup.getInitialPath(), backup.getDestinationPath(), null)) return false; + + if(backup.isAutoBackup() == false || backup.getNextDateBackup() == null || backup.getTimeIntervalBackup() == null) { + // if the file has not been saved you need to save it before setting the auto backup + if (backup.getBackupName() == null || backup.getBackupName().isEmpty()) SaveWithName(); + if (backup.getBackupName() == null || backup.getBackupName().isEmpty()) return false; - OpenInitialFolderItem.setText("Open initial folder"); - OpenInitialFolderItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - OpenInitialFolderItemActionPerformed(evt); - } - }); - TablePopup.add(OpenInitialFolderItem); + // message + TimeInterval timeInterval = openTimePicker(null); + if (timeInterval == null) return false; - OpenInitialDestinationItem.setText("Open destination folder"); - OpenInitialDestinationItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - OpenInitialDestinationItemActionPerformed(evt); - } - }); - TablePopup.add(OpenInitialDestinationItem); - TablePopup.add(jSeparator3); + //set date for next backup + LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) + .plusHours(timeInterval.getHours()) + .plusMinutes(timeInterval.getMinutes()); - Backup.setText("Backup"); + backup.setTimeIntervalBackup(timeInterval); + backup.setNextDateBackup(nextDateBackup); + btnTimePicker.setToolTipText(timeInterval.toString()); + btnTimePicker.setEnabled(true); - RunBackupPopupItem.setText("Run single backup"); - RunBackupPopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - RunBackupPopupItemActionPerformed(evt); - } - }); - Backup.add(RunBackupPopupItem); + Logger.logMessage("Event --> Next date backup setted to " + nextDateBackup, Logger.LogLevel.INFO); + JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + backup.getInitialPath() + "\n\tTo: " + backup.getDestinationPath() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); + } - AutoBackupMenuItem.setSelected(true); - AutoBackupMenuItem.setText("Auto Backup"); - AutoBackupMenuItem.setToolTipText(""); - AutoBackupMenuItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - AutoBackupMenuItemActionPerformed(evt); + for (Backup b : backups) { + if (b.getBackupName().equals(backup.getBackupName())) { + b.UpdateBackup(backup); + break; } - }); - Backup.add(AutoBackupMenuItem); - - TablePopup.add(Backup); - TablePopup.add(jSeparator2); - - jMenu4.setText("Copy text"); + } + + // if the backup is currentBackup + if (currentBackup.getBackupName().equals(backup.getBackupName())) + currentBackup.UpdateBackup(backup); + + BackupOperations.updateBackupList(backups); + return true; + } + + private void SaveWithName() { + Logger.logMessage("Event --> save with name", Logger.LogLevel.INFO); - CopyBackupNamePopupItem.setText("Copy backup name"); - CopyBackupNamePopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CopyBackupNamePopupItemActionPerformed(evt); - } - }); - jMenu4.add(CopyBackupNamePopupItem); + String backup_name = getBackupName(true); + + if (backup_name == null || backup_name.length() == 0) return; - CopyInitialPathPopupItem.setText("Copy initial path"); - CopyInitialPathPopupItem.setToolTipText(""); - CopyInitialPathPopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CopyInitialPathPopupItemActionPerformed(evt); + try { + LocalDateTime dateNow = LocalDateTime.now(); + Backup backup = new Backup ( + backup_name, + GetStartPathField(), + GetDestinationPathField(), + currentBackup.getLastBackup(), + currentBackup.isAutoBackup(), + currentBackup.getNextDateBackup(), + currentBackup.getTimeIntervalBackup(), + GetNotesTextArea(), + dateNow, + dateNow, + 0 + ); + + backups.add(backup); + currentBackup = backup; + + BackupOperations.updateBackupList(backups); + Logger.logMessage("Backup '" + currentBackup.getBackupName() + "' saved successfully!", Logger.LogLevel.INFO); + JOptionPane.showMessageDialog(this, "Backup '" + currentBackup.getBackupName() + "' saved successfully!", "Backup saved", JOptionPane.INFORMATION_MESSAGE); + savedChanges(true); + } catch (IllegalArgumentException ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } catch (HeadlessException ex) { + Logger.logMessage("Error saving backup", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Error saving backup", "Error", JOptionPane.ERROR_MESSAGE); + } + } + + private String getBackupName(boolean canOverwrite) { + String backup_name; + do { + backup_name = JOptionPane.showInputDialog(null, "Name of the backup"); // pop-up message + for (Backup backup : backups) { + if (backup.getBackupName().equals(backup_name) && canOverwrite) { + int response = JOptionPane.showConfirmDialog(null, "A backup with the same name already exists, do you want to overwrite it?", "Confimation required", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (response == JOptionPane.YES_OPTION) { + backups.remove(backup); + break; + } else { + backup_name = null; + } + } else if (backup.getBackupName().equals(backup_name)) { + Logger.logMessage("Error saving backup", Logger.LogLevel.WARN); + JOptionPane.showConfirmDialog(null, "Backup name already used!", "Error", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE); + } } - }); - jMenu4.add(CopyInitialPathPopupItem); + if (backup_name == null) return null; + } while (backup_name.equals("null") || backup_name.equals("null*")); + if (backup_name.isEmpty()) return null; + return backup_name; + } + + public void SingleBackup(String path1, String path2) { + Logger.logMessage("Event --> single backup", Logger.LogLevel.INFO); + + String temp = "\\"; - CopyDestinationPathPopupItem.setText("Copy destination path"); - CopyDestinationPathPopupItem.setToolTipText(""); - CopyDestinationPathPopupItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CopyDestinationPathPopupItemActionPerformed(evt); - } - }); - jMenu4.add(CopyDestinationPathPopupItem); + //------------------------------INPUT CONTROL ERRORS------------------------------ + if(!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(), path1, path2, null)) return; - TablePopup.add(jMenu4); + //------------------------------TO GET THE CURRENT DATE------------------------------ + LocalDateTime dateNow = LocalDateTime.now(); - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Backup Manager"); + //------------------------------SET ALL THE VARIABLES------------------------------ + String name1; // folder name/initial file + String date = dateNow.format(dateForfolderNameFormatter); - jPanel1.setMaximumSize(new java.awt.Dimension(464, 472)); - jPanel1.setLayout(new java.awt.GridBagLayout()); + //------------------------------SET ALL THE STRINGS------------------------------ + name1 = path1.substring(path1.length()-1, path1.length()-1); - txtTitle.setFont(new java.awt.Font("Segoe UI", 0, 36)); // NOI18N - txtTitle.setLabelFor(txtTitle); - txtTitle.setText("DEMO - Backup Entry"); - txtTitle.setToolTipText(""); - txtTitle.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); - txtTitle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + for(int i=path1.length()-1; i>=0; i--) { + if(path1.charAt(i) != temp.charAt(0)) name1 = path1.charAt(i) + name1; + else break; + } - currentFileLabel.setText("Current file: "); + path2 = path2 + "\\" + name1 + " (Backup " + date + ")"; - startPathField.setToolTipText("(Required) Initial path"); - startPathField.setActionCommand("null"); - startPathField.setAlignmentX(0.0F); - startPathField.setAlignmentY(0.0F); - startPathField.setAutoscrolls(false); - startPathField.setMaximumSize(new java.awt.Dimension(68, 26)); + //------------------------------COPY THE FILE OR DIRECTORY------------------------------ + Logger.logMessage("date backup: " + date, Logger.LogLevel.INFO); + + try { + progressBar = new BackupProgressGUI(path1, path2); + progressBar.setVisible(true); + BackupOperations.zipDirectory(path1, path2+".zip", currentBackup, null, progressBar); + + //if current_file_opened is null it means they are not in a backup but it is a backup with no associated json file + if (currentBackup.getBackupName() != null && !currentBackup.getBackupName().isEmpty()) { + currentBackup.setInitialPath(GetStartPathField()); + currentBackup.setDestinationPath(GetDestinationPathField()); + currentBackup.setLastBackup(LocalDateTime.now()); - btnPathSearch1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/folder.png"))); // NOI18N - btnPathSearch1.setToolTipText("Open file explorer"); - btnPathSearch1.setBorderPainted(false); - btnPathSearch1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - btnPathSearch1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPathSearch1ActionPerformed(evt); } - }); + + } catch (IOException e) { + Logger.logMessage("Error during the backup operation: the initial path is incorrect!", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Error during the backup operation: the initial path is incorrect!", "Error", JOptionPane.ERROR_MESSAGE); + } + } + + private void setCurrentBackupName(String name) { + currentFileLabel.setText("Current File: " + name); + } + + private void setCurrentBackupNotes(String notes) { + backupNoteTextArea.setText(notes); + } + + public void setStringToText() { + try { + String last_date = LocalDateTime.now().format(formatter); + lastBackupLabel.setText("last backup: " + last_date); + } catch(Exception ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } + } + + public void setTextValues() { + try { + updateCurrentFiedsByBackup(currentBackup); + } catch (IllegalArgumentException ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } + setAutoBackupPreference(currentBackup.isAutoBackup()); + } + + private void customListeners() { + startPathField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + savedChanges(false); + } - destinationPathField.setToolTipText("(Required) Destination path"); - destinationPathField.setActionCommand(""); - destinationPathField.setAlignmentX(0.0F); - destinationPathField.setAlignmentY(0.0F); - destinationPathField.setMaximumSize(new java.awt.Dimension(68, 26)); + @Override + public void removeUpdate(DocumentEvent e) {} - btnPathSearch2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/folder.png"))); // NOI18N - btnPathSearch2.setToolTipText("Open file explorer"); - btnPathSearch2.setBorderPainted(false); - btnPathSearch2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - btnPathSearch2.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPathSearch2ActionPerformed(evt); - } + @Override + public void changedUpdate(DocumentEvent e) {} }); + + destinationPathField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + savedChanges(false); + } - lastBackupLabel.setText("last backup: "); + @Override + public void removeUpdate(DocumentEvent e) {} - SingleBackup.setBackground(new java.awt.Color(51, 153, 255)); - SingleBackup.setForeground(new java.awt.Color(255, 255, 255)); - SingleBackup.setText("Single Backup"); - SingleBackup.setToolTipText("Perform the backup"); - SingleBackup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - SingleBackup.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - SingleBackupActionPerformed(evt); - } + @Override + public void changedUpdate(DocumentEvent e) {} }); + + backupNoteTextArea.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + savedChanges(false); + } - backupNoteTextArea.setColumns(20); - backupNoteTextArea.setRows(5); - backupNoteTextArea.setToolTipText("(Optional) Backup description"); - backupNoteTextArea.setMaximumSize(new java.awt.Dimension(232, 84)); - backupNoteTextArea.setMinimumSize(new java.awt.Dimension(232, 84)); - jScrollPane2.setViewportView(backupNoteTextArea); - - jLabel2.setText("notes:"); + @Override + public void removeUpdate(DocumentEvent e) {} - btnTimePicker.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/chronometer.png"))); // NOI18N - btnTimePicker.setToolTipText("time picker"); - btnTimePicker.setBorderPainted(false); - btnTimePicker.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - btnTimePicker.setEnabled(false); - btnTimePicker.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTimePickerActionPerformed(evt); - } - }); - - toggleAutoBackup.setText("Auto Backup"); - toggleAutoBackup.setToolTipText("Enable/Disable automatic backup"); - toggleAutoBackup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - toggleAutoBackup.setPreferredSize(new java.awt.Dimension(108, 27)); - toggleAutoBackup.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - toggleAutoBackupActionPerformed(evt); - } + @Override + public void changedUpdate(DocumentEvent e) {} }); + } + + public String GetStartPathField() { + return startPathField.getText(); + } + public String GetDestinationPathField() { + return destinationPathField.getText(); + } + public String GetNotesTextArea() { + return backupNoteTextArea.getText(); + } + public boolean GetAutomaticBackupPreference() { + return toggleAutoBackup.isSelected(); + } + public void SetStartPathField(String text) { + startPathField.setText(text); + } + public void SetDestinationPathField(String text) { + destinationPathField.setText(text); + } + public void SetLastBackupLabel(LocalDateTime date) { + if (date != null) { + String dateStr = date.format(formatter); + dateStr = "last backup: " + dateStr; + lastBackupLabel.setText(dateStr); + } + else lastBackupLabel.setText(""); + } + + public static void OpenExceptionMessage(String errorMessage, String stackTrace) { + Object[] options = {"Close", "Copy to clipboard", "Report the Problem"}; - jPanel3.setMaximumSize(new java.awt.Dimension(100, 100)); - jPanel3.setMinimumSize(new java.awt.Dimension(100, 100)); - jPanel3.setPreferredSize(new java.awt.Dimension(100, 100)); + if (errorMessage == null ) { + errorMessage = ""; + } + stackTrace = !errorMessage.isEmpty() ? errorMessage + "\n" + stackTrace : errorMessage + stackTrace; + String stackTraceMessage = "Please report this error, either with an image of the screen or by copying the following error text (it is appreciable to provide a description of the operations performed before the error): \n" + stackTrace; - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 150, Short.MAX_VALUE) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); + int choice; - jPanel4.setMaximumSize(new java.awt.Dimension(100, 100)); - jPanel4.setPreferredSize(new java.awt.Dimension(100, 100)); + // Keep displaying the dialog until the "Close" option (index 0) is chosen + do { + if (stackTraceMessage.length() > 1500) { + stackTraceMessage = stackTraceMessage.substring(0, 1500) + "..."; + } + + // Display the option dialog + choice = JOptionPane.showOptionDialog( + null, + stackTraceMessage, // The detailed message or stack trace + "Error...", // The error message/title + JOptionPane.DEFAULT_OPTION, // Option type (default option type) + JOptionPane.ERROR_MESSAGE, // Message type (error message icon) + null, // Icon (null means default icon) + options, // The options for the buttons + options[0] // The default option (Close) + ); + + if (choice == 1) { + StringSelection selection = new StringSelection(stackTrace); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); + Logger.logMessage("Error text has been copied to the clipboard", Logger.LogLevel.INFO); + JOptionPane.showMessageDialog(null, "Error text has been copied to the clipboard."); + } else if (choice == 2) { + openWebSite(ConfigKey.ISSUE_PAGE_LINK.getValue()); + } + } while (choice == 1 || choice == 2); + } + + private static void openWebSite(String reportUrl) { + try { + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); + if (desktop.isSupported(Desktop.Action.BROWSE)) { + desktop.browse(new URI(reportUrl)); + } + } + } catch (IOException | URISyntaxException e) { + Logger.logMessage("Failed to open the web page. Please try again", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Failed to open the web page. Please try again.", "Error", JOptionPane.ERROR_MESSAGE); + } + } + + private void displayBackupList(List backups) { + model = new DefaultTableModel(new Object[]{"Backup Name", "Initial Path", "Destination Path", "Last Backup", "Automatic Backup", "Next Backup Date", "Time Interval"}, 0) { - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 150, Short.MAX_VALUE) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); + @Override + public Class getColumnClass(int columnIndex) { + if (columnIndex == 4) { + return Boolean.class; + } + return super.getColumnClass(columnIndex); + } - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(SingleBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(toggleAutoBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(4, 4, 4) - .addComponent(btnTimePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(268, 268, 268)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(162, 162, 162) - .addComponent(currentFileLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(164, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(3, 3, 3) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(64, 64, 64) - .addComponent(txtTitle)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(startPathField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(5, 5, 5) - .addComponent(btnPathSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(destinationPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 423, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(5, 5, 5) - .addComponent(btnPathSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 462, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lastBackupLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE)))))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() - .addGap(101, 101, 101) - .addComponent(currentFileLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 369, Short.MAX_VALUE) - .addComponent(SingleBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(10, 10, 10) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(toggleAutoBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(2, 2, 2) - .addComponent(btnTimePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(21, 21, 21)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(25, 25, 25) - .addComponent(txtTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(36, 36, 36) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(startPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnPathSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(15, 15, 15) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(destinationPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnPathSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(10, 10, 10) - .addComponent(lastBackupLabel) - .addGap(10, 10, 10) - .addComponent(jLabel2) - .addGap(10, 10, 10) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 571, Short.MAX_VALUE) - .addContainerGap()))) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) - .addContainerGap())))) - ); + @Override + public boolean isCellEditable(int row, int column) { + return false; + } + }; - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.ipady = 129; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - jPanel1.add(jPanel5, gridBagConstraints); + table.setModel(model); - TabbedPane.addTab("BackupEntry", jPanel1); + for (int i = 0; i < backups.size(); i++) { + Backup backup = backups.get(i); - tablePanel.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - tablePanelMouseClicked(evt); + if (i >= model.getRowCount()) { + model.addRow(new Object[]{"", "", "", "", "", "", ""}); } - }); - addBackupEntryButton.setForeground(new java.awt.Color(0, 0, 0)); - addBackupEntryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/plus.png"))); // NOI18N - addBackupEntryButton.setToolTipText("Add new backup"); - addBackupEntryButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); - addBackupEntryButton.setPreferredSize(new java.awt.Dimension(25, 25)); - addBackupEntryButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - addBackupEntryButtonActionPerformed(evt); - } - }); + model.setValueAt(backup.getBackupName(), i, 0); + model.setValueAt(backup.getInitialPath(), i, 1); + model.setValueAt(backup.getDestinationPath(), i, 2); + model.setValueAt(backup.getLastBackup() != null ? backup.getLastBackup().format(formatter) : "", i, 3); + model.setValueAt(backup.isAutoBackup(), i, 4); + model.setValueAt(backup.getNextDateBackup() != null ? backup.getNextDateBackup().format(formatter) : "", i, 5); + model.setValueAt(backup.getTimeIntervalBackup() != null ? backup.getTimeIntervalBackup().toString() : "", i, 6); + } - table.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { + DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - }, - new String [] { - "Backup name", "Initial path", "Destination path", "Last backup", "Auto backup", "Next date backup", "Days interval backup" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Boolean.class, java.lang.String.class, java.lang.Integer.class - }; - boolean[] canEdit = new boolean [] { - false, false, false, false, false, false, false - }; + if (row % 2 == 0) { + c.setBackground(new Color(223, 222, 243)); + } else { + c.setBackground(Color.WHITE); + } - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } + if (isSelected) { + c.setBackground(table.getSelectionBackground()); + c.setForeground(table.getSelectionForeground()); + } else { + c.setForeground(Color.BLACK); + } - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); - table.setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR)); - table.setRowHeight(50); - table.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - tableMouseClicked(evt); + return c; } - }); - jScrollPane1.setViewportView(table); + }; - jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 20)); // NOI18N - jLabel1.setText("|"); - jLabel1.setAlignmentY(0.0F); + TableCellRenderer checkboxRenderer = new DefaultTableCellRenderer() { + private final JCheckBox checkBox = new JCheckBox(); - researchField.setToolTipText("Research bar"); - researchField.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyTyped(java.awt.event.KeyEvent evt) { - researchFieldKeyTyped(evt); - } - }); + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + if (value instanceof Boolean aBoolean) { + checkBox.setSelected(aBoolean); + checkBox.setHorizontalAlignment(CENTER); - javax.swing.GroupLayout tablePanelLayout = new javax.swing.GroupLayout(tablePanel); - tablePanel.setLayout(tablePanelLayout); - tablePanelLayout.setHorizontalGroup( - tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(tablePanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(tablePanelLayout.createSequentialGroup() - .addComponent(addBackupEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(researchField, javax.swing.GroupLayout.PREFERRED_SIZE, 321, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(tablePanelLayout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 763, Short.MAX_VALUE) - .addContainerGap()))) - ); - tablePanelLayout.setVerticalGroup( - tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(tablePanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(addBackupEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(researchField, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE) - .addContainerGap()) - ); + if (row % 2 == 0) { + checkBox.setBackground(new Color(223, 222, 243)); + } else { + checkBox.setBackground(Color.WHITE); + } - researchField.getAccessibleContext().setAccessibleName(""); + if (isSelected) { + checkBox.setBackground(table.getSelectionBackground()); + checkBox.setForeground(table.getSelectionForeground()); + } else { + checkBox.setForeground(Color.BLACK); + } - detailsLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); + return checkBox; + } + return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + } + }; - javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); - detailsPanel.setLayout(detailsPanelLayout); - detailsPanelLayout.setHorizontalGroup( - detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailsPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(detailsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - ); - detailsPanelLayout.setVerticalGroup( - detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(detailsPanelLayout.createSequentialGroup() - .addComponent(detailsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + TableColumnModel columnModel = table.getColumnModel(); + for (int i = 0; i < columnModel.getColumnCount(); i++) { + columnModel.getColumn(i).setCellRenderer(renderer); + } - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(detailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tablePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); + columnModel.getColumn(4).setCellRenderer(checkboxRenderer); + columnModel.getColumn(4).setCellEditor(table.getDefaultEditor(Boolean.class)); + } + + // Method to properly encode the URI with special characters (spaces, symbols, etc.) + private static String encodeURI(String value) { + try { + return java.net.URLEncoder.encode(value, "UTF-8").replace("+", "%20"); + } catch (IOException e) { + return value; // If encoding fails, return the original value + } + } + + public void Clear() { + Logger.logMessage("Event --> clear", Logger.LogLevel.INFO); + + if (!saveChanged) { + int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to clean the fields?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (response != JOptionPane.YES_OPTION) { + return; + } + } + + startPathField.setText(""); + destinationPathField.setText(""); + lastBackupLabel.setText(""); + backupNoteTextArea.setText(""); + } + + private void RemoveBackup(String backupName) { + Logger.logMessage("Event --> removing backup", Logger.LogLevel.INFO); - TabbedPane.addTab("BackupList", jPanel2); + // backup list update + for (Backup backup : backups) { + if (backupName.equals(backup.getBackupName())) { + backups.remove(backup); + break; + } + } + + BackupOperations.updateBackupList(backups); + } + + private void saveFile() { + Logger.logMessage("Event --> saving backup", Logger.LogLevel.INFO); + + if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) { + SaveWithName(); + } - jLabel3.setText("Version 2.0.2"); + try { + currentBackup.setInitialPath(GetStartPathField()); + currentBackup.setDestinationPath(GetDestinationPathField()); + currentBackup.setNotes(GetNotesTextArea()); + + LocalDateTime dateNow = LocalDateTime.now(); + currentBackup.setLastUpdateDate(dateNow); + + for (Backup b : backups) { + if (b.getBackupName().equals(currentBackup.getBackupName())) { + b.UpdateBackup(currentBackup); + break; + } + } + BackupOperations.updateBackupList(backups); + savedChanges(true); + } catch (IllegalArgumentException ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } + } + + private void OpenBackup(String backupName) { + Logger.logMessage("Event --> opening backup", Logger.LogLevel.INFO); + + if (!saveChanged) { + int response = JOptionPane.showConfirmDialog(null, "There are unsaved changes, do you want to save them before moving to another file?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (response == JOptionPane.YES_OPTION) { + saveFile(); + } else if (response == JOptionPane.CANCEL_OPTION) { + return; + } + } + + try { + for(Backup backup : backups) { + if (backup.getBackupName().equals(backupName)) { + currentBackup = backup; + break; + } + } + + updateCurrentFiedsByBackup(currentBackup); + backupNoteTextArea.setEnabled(true); + savedChanges(true); + } catch (IllegalArgumentException ex) { + Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); + OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + } + } + + private void pathSearchWithFileChooser(JTextField textField, boolean allowFiles) { + JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory()); + + if (allowFiles) + jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + else + jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - jMenu1.setText("File"); + int returnValue = jfc.showSaveDialog(null); + if (returnValue == JFileChooser.APPROVE_OPTION) { + File selectedFile = jfc.getSelectedFile(); - MenuNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_DOWN_MASK)); - MenuNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/add-file.png"))); // NOI18N - MenuNew.setText("New"); - MenuNew.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuNewActionPerformed(evt); + // Logga il tipo di elemento selezionato + if (selectedFile.isDirectory()) { + Logger.logMessage("You selected the directory: " + selectedFile, Logger.LogLevel.INFO); + } else if (selectedFile.isFile()) { + Logger.logMessage("You selected the file: " + selectedFile, Logger.LogLevel.INFO); } - }); - jMenu1.add(MenuNew); - MenuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK)); - MenuSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/diskette.png"))); // NOI18N - MenuSave.setText("Save"); - MenuSave.addActionListener(new java.awt.event.ActionListener() { + // Imposta il percorso nel campo di testo + textField.setText(selectedFile.toString()); + } + savedChanges(false); + } + + private void researchInTable() { + List tempBackups = new ArrayList<>(); + + String research = researchField.getText(); + + for (Backup backup : backups) { + if (backup.getBackupName().contains(research) || + backup.getInitialPath().contains(research) || + backup.getDestinationPath().contains(research) || + (backup.getLastBackup() != null && backup.getLastBackup().toString().contains(research)) || + (backup.getNextDateBackup() != null && backup.getNextDateBackup().toString().contains(research)) || + (backup.getTimeIntervalBackup() != null && backup.getTimeIntervalBackup().toString().contains(research))) { + tempBackups.add(backup); + } + } + + BackupOperations.updateTableWithNewBackupList(tempBackups); + } + + private void updateCurrentFiedsByBackup(Backup backup) { + SetStartPathField(backup.getInitialPath()); + SetDestinationPathField(backup.getDestinationPath()); + SetLastBackupLabel(backup.getLastUpdateDate()); + setAutoBackupPreference(backup.isAutoBackup()); + setCurrentBackupName(backup.getBackupName()); + setCurrentBackupNotes(backup.getNotes()); + + if (backup.getTimeIntervalBackup() != null) { + btnTimePicker.setToolTipText(backup.getTimeIntervalBackup().toString()); + btnTimePicker.setEnabled(true); + } else { + btnTimePicker.setToolTipText(""); + btnTimePicker.setEnabled(false); + } + } + + private void NewBackup() { + Logger.logMessage("Event --> new backup", Logger.LogLevel.INFO); + + if (!saveChanged && !currentBackup.getBackupName().isEmpty()) { + int response = JOptionPane.showConfirmDialog(null, "There are unsaved changes, do you want to save them before moving to another backup?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (response == JOptionPane.YES_OPTION) { + saveFile(); + } else if (response == JOptionPane.CANCEL_OPTION) { + return; + } + } + + Clear(); + currentBackup = new Backup(); + currentBackup.setAutoBackup(false); + currentBackup.setBackupName(""); + + // basic auto enable is disabled + setAutoBackupPreference(currentBackup.isAutoBackup()); + + // I remove the current open backup + setCurrentBackupName("untitled*"); + } + + private void disableAutoBackup(Backup backup) { + Logger.logMessage("Event --> auto backup disabled", Logger.LogLevel.INFO); + + backup.setTimeIntervalBackup(null); + backup.setNextDateBackup(null); + backup.setLastUpdateDate(LocalDateTime.now()); + BackupOperations.updateBackupList(backups); + + // if the backup is the current backup i have to update the main panel + if (backup.getBackupName().equals(currentBackup.getBackupName())) { + btnTimePicker.setToolTipText(""); + btnTimePicker.setEnabled(false); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + TablePopup = new javax.swing.JPopupMenu(); + EditPoputItem = new javax.swing.JMenuItem(); + DeletePopupItem = new javax.swing.JMenuItem(); + DuplicatePopupItem = new javax.swing.JMenuItem(); + renamePopupItem = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + OpenInitialFolderItem = new javax.swing.JMenuItem(); + OpenInitialDestinationItem = new javax.swing.JMenuItem(); + jSeparator3 = new javax.swing.JPopupMenu.Separator(); + Backup = new javax.swing.JMenu(); + RunBackupPopupItem = new javax.swing.JMenuItem(); + AutoBackupMenuItem = new javax.swing.JCheckBoxMenuItem(); + jSeparator2 = new javax.swing.JPopupMenu.Separator(); + jMenu4 = new javax.swing.JMenu(); + CopyBackupNamePopupItem = new javax.swing.JMenuItem(); + CopyInitialPathPopupItem = new javax.swing.JMenuItem(); + CopyDestinationPathPopupItem = new javax.swing.JMenuItem(); + TabbedPane = new javax.swing.JTabbedPane(); + jPanel1 = new javax.swing.JPanel(); + jPanel5 = new javax.swing.JPanel(); + txtTitle = new javax.swing.JLabel(); + currentFileLabel = new javax.swing.JLabel(); + startPathField = new javax.swing.JTextField(); + btnPathSearch1 = new javax.swing.JButton(); + destinationPathField = new javax.swing.JTextField(); + btnPathSearch2 = new javax.swing.JButton(); + lastBackupLabel = new javax.swing.JLabel(); + SingleBackup = new javax.swing.JButton(); + jScrollPane2 = new javax.swing.JScrollPane(); + backupNoteTextArea = new javax.swing.JTextArea(); + jLabel2 = new javax.swing.JLabel(); + btnTimePicker = new javax.swing.JButton(); + toggleAutoBackup = new javax.swing.JToggleButton(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0)); + jPanel3 = new javax.swing.JPanel(); + jPanel4 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + tablePanel = new javax.swing.JPanel(); + addBackupEntryButton = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + table = new javax.swing.JTable(); + jLabel1 = new javax.swing.JLabel(); + researchField = new javax.swing.JTextField(); + detailsPanel = new javax.swing.JPanel(); + detailsLabel = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + MenuNew = new javax.swing.JMenuItem(); + MenuSave = new javax.swing.JMenuItem(); + MenuSaveWithName = new javax.swing.JMenuItem(); + MenuClear = new javax.swing.JMenuItem(); + MenuHistory = new javax.swing.JMenuItem(); + jMenu2 = new javax.swing.JMenu(); + MenuBugReport = new javax.swing.JMenuItem(); + MenuQuit = new javax.swing.JMenuItem(); + jMenu3 = new javax.swing.JMenu(); + MenuShare = new javax.swing.JMenuItem(); + MenuDonate = new javax.swing.JMenuItem(); + MenuInfoPage = new javax.swing.JMenuItem(); + jMenu5 = new javax.swing.JMenu(); + MenuWebsite = new javax.swing.JMenuItem(); + MenuSupport = new javax.swing.JMenuItem(); + + EditPoputItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/pen.png"))); // NOI18N + EditPoputItem.setText("Edit"); + EditPoputItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuSaveActionPerformed(evt); + EditPoputItemActionPerformed(evt); } }); - jMenu1.add(MenuSave); + TablePopup.add(EditPoputItem); - MenuSaveWithName.setText("Save with name"); - MenuSaveWithName.addActionListener(new java.awt.event.ActionListener() { + DeletePopupItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/bin.png"))); // NOI18N + DeletePopupItem.setText("Delete"); + DeletePopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuSaveWithNameActionPerformed(evt); + DeletePopupItemActionPerformed(evt); } }); - jMenu1.add(MenuSaveWithName); + TablePopup.add(DeletePopupItem); - MenuClear.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_DOWN_MASK)); - MenuClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/clean.png"))); // NOI18N - MenuClear.setText("Clear"); - MenuClear.addActionListener(new java.awt.event.ActionListener() { + DuplicatePopupItem.setText("Duplicate"); + DuplicatePopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuClearActionPerformed(evt); + DuplicatePopupItemActionPerformed(evt); } }); - jMenu1.add(MenuClear); + TablePopup.add(DuplicatePopupItem); - MenuHistory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/clock.png"))); // NOI18N - MenuHistory.setText("History"); - MenuHistory.addActionListener(new java.awt.event.ActionListener() { + renamePopupItem.setText("Rename backup"); + renamePopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuHistoryActionPerformed(evt); + renamePopupItemActionPerformed(evt); } }); - jMenu1.add(MenuHistory); - - jMenuBar1.add(jMenu1); - - jMenu2.setText("Options"); + TablePopup.add(renamePopupItem); + TablePopup.add(jSeparator1); - MenuBugReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/bug.png"))); // NOI18N - MenuBugReport.setText("Report a bug"); - MenuBugReport.addActionListener(new java.awt.event.ActionListener() { + OpenInitialFolderItem.setText("Open initial folder"); + OpenInitialFolderItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuBugReportActionPerformed(evt); + OpenInitialFolderItemActionPerformed(evt); } }); - jMenu2.add(MenuBugReport); + TablePopup.add(OpenInitialFolderItem); - MenuQuit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_DOWN_MASK)); - MenuQuit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/remove.png"))); // NOI18N - MenuQuit.setText("Quit"); - MenuQuit.addActionListener(new java.awt.event.ActionListener() { + OpenInitialDestinationItem.setText("Open destination folder"); + OpenInitialDestinationItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuQuitActionPerformed(evt); + OpenInitialDestinationItemActionPerformed(evt); } }); - jMenu2.add(MenuQuit); - - jMenuBar1.add(jMenu2); + TablePopup.add(OpenInitialDestinationItem); + TablePopup.add(jSeparator3); - jMenu3.setText("About"); + Backup.setText("Backup"); - MenuShare.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/share.png"))); // NOI18N - MenuShare.setText("Share"); - MenuShare.addActionListener(new java.awt.event.ActionListener() { + RunBackupPopupItem.setText("Run single backup"); + RunBackupPopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuShareActionPerformed(evt); + RunBackupPopupItemActionPerformed(evt); } }); - jMenu3.add(MenuShare); + Backup.add(RunBackupPopupItem); - MenuDonate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/donation.png"))); // NOI18N - MenuDonate.setText("Donate"); - MenuDonate.setEnabled(false); - MenuDonate.addActionListener(new java.awt.event.ActionListener() { + AutoBackupMenuItem.setSelected(true); + AutoBackupMenuItem.setText("Auto Backup"); + AutoBackupMenuItem.setToolTipText(""); + AutoBackupMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuDonateActionPerformed(evt); + AutoBackupMenuItemActionPerformed(evt); } }); - jMenu3.add(MenuDonate); + Backup.add(AutoBackupMenuItem); - MenuInfoPage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/info.png"))); // NOI18N - MenuInfoPage.setText("Info"); - MenuInfoPage.addActionListener(new java.awt.event.ActionListener() { + TablePopup.add(Backup); + TablePopup.add(jSeparator2); + + jMenu4.setText("Copy text"); + + CopyBackupNamePopupItem.setText("Copy backup name"); + CopyBackupNamePopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuInfoPageActionPerformed(evt); + CopyBackupNamePopupItemActionPerformed(evt); } }); - jMenu3.add(MenuInfoPage); - - jMenuBar1.add(jMenu3); - - jMenu5.setText("Help"); + jMenu4.add(CopyBackupNamePopupItem); - MenuWebsite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/website.png"))); // NOI18N - MenuWebsite.setText("Website"); - MenuWebsite.addActionListener(new java.awt.event.ActionListener() { + CopyInitialPathPopupItem.setText("Copy initial path"); + CopyInitialPathPopupItem.setToolTipText(""); + CopyInitialPathPopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuWebsiteActionPerformed(evt); + CopyInitialPathPopupItemActionPerformed(evt); } }); - jMenu5.add(MenuWebsite); + jMenu4.add(CopyInitialPathPopupItem); - MenuSupport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/help-desk.png"))); // NOI18N - MenuSupport.setText("Support"); - MenuSupport.addActionListener(new java.awt.event.ActionListener() { + CopyDestinationPathPopupItem.setText("Copy destination path"); + CopyDestinationPathPopupItem.setToolTipText(""); + CopyDestinationPathPopupItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - MenuSupportActionPerformed(evt); + CopyDestinationPathPopupItemActionPerformed(evt); } }); - jMenu5.add(MenuSupport); + jMenu4.add(CopyDestinationPathPopupItem); - jMenuBar1.add(jMenu5); + TablePopup.add(jMenu4); - setJMenuBar(jMenuBar1); + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Backup Manager"); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(TabbedPane, javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(TabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE) - .addComponent(jLabel3) - .addContainerGap()) - ); + jPanel1.setMaximumSize(new java.awt.Dimension(464, 472)); + jPanel1.setLayout(new java.awt.GridBagLayout()); - pack(); - setLocationRelativeTo(null); - }// //GEN-END:initComponents + txtTitle.setFont(new java.awt.Font("Segoe UI", 0, 36)); // NOI18N + txtTitle.setLabelFor(txtTitle); + txtTitle.setText("DEMO - Backup Entry"); + txtTitle.setToolTipText(""); + txtTitle.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + txtTitle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - private void displayBackupList(List backups) { - model = new DefaultTableModel(new Object[]{"Backup Name", "Initial Path", "Destination Path", "Last Backup", "Automatic Backup", "Next Backup Date", "Time Interval"}, 0) { + currentFileLabel.setText("Current file: "); - @Override - public Class getColumnClass(int columnIndex) { - if (columnIndex == 4) { - return Boolean.class; - } - return super.getColumnClass(columnIndex); - } + startPathField.setToolTipText("(Required) Initial path"); + startPathField.setActionCommand("null"); + startPathField.setAlignmentX(0.0F); + startPathField.setAlignmentY(0.0F); + startPathField.setAutoscrolls(false); + startPathField.setMaximumSize(new java.awt.Dimension(68, 26)); - @Override - public boolean isCellEditable(int row, int column) { - return false; + btnPathSearch1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/folder.png"))); // NOI18N + btnPathSearch1.setToolTipText("Open file explorer"); + btnPathSearch1.setBorderPainted(false); + btnPathSearch1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + btnPathSearch1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnPathSearch1ActionPerformed(evt); } - }; - - table.setModel(model); + }); - for (int i = 0; i < backups.size(); i++) { - Backup backup = backups.get(i); + destinationPathField.setToolTipText("(Required) Destination path"); + destinationPathField.setActionCommand(""); + destinationPathField.setAlignmentX(0.0F); + destinationPathField.setAlignmentY(0.0F); + destinationPathField.setMaximumSize(new java.awt.Dimension(68, 26)); - if (i >= model.getRowCount()) { - model.addRow(new Object[]{"", "", "", "", "", "", ""}); + btnPathSearch2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/folder.png"))); // NOI18N + btnPathSearch2.setToolTipText("Open file explorer"); + btnPathSearch2.setBorderPainted(false); + btnPathSearch2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + btnPathSearch2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnPathSearch2ActionPerformed(evt); } + }); - model.setValueAt(backup.getBackupName(), i, 0); - model.setValueAt(backup.getInitialPath(), i, 1); - model.setValueAt(backup.getDestinationPath(), i, 2); - model.setValueAt(backup.getLastBackup() != null ? backup.getLastBackup().format(formatter) : "", i, 3); - model.setValueAt(backup.isAutoBackup(), i, 4); - model.setValueAt(backup.getNextDateBackup() != null ? backup.getNextDateBackup().format(formatter) : "", i, 5); - model.setValueAt(backup.getTimeIntervalBackup() != null ? backup.getTimeIntervalBackup().toString() : "", i, 6); - } - - DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() { - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + lastBackupLabel.setText("last backup: "); - if (row % 2 == 0) { - c.setBackground(new Color(223, 222, 243)); - } else { - c.setBackground(Color.WHITE); - } + SingleBackup.setBackground(new java.awt.Color(51, 153, 255)); + SingleBackup.setForeground(new java.awt.Color(255, 255, 255)); + SingleBackup.setText("Single Backup"); + SingleBackup.setToolTipText("Perform the backup"); + SingleBackup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + SingleBackup.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SingleBackupActionPerformed(evt); + } + }); - if (isSelected) { - c.setBackground(table.getSelectionBackground()); - c.setForeground(table.getSelectionForeground()); - } else { - c.setForeground(Color.BLACK); - } + backupNoteTextArea.setColumns(20); + backupNoteTextArea.setRows(5); + backupNoteTextArea.setToolTipText("(Optional) Backup description"); + backupNoteTextArea.setMaximumSize(new java.awt.Dimension(232, 84)); + backupNoteTextArea.setMinimumSize(new java.awt.Dimension(232, 84)); + jScrollPane2.setViewportView(backupNoteTextArea); - return c; - } - }; + jLabel2.setText("notes:"); - TableCellRenderer checkboxRenderer = new DefaultTableCellRenderer() { - private final JCheckBox checkBox = new JCheckBox(); + btnTimePicker.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/chronometer.png"))); // NOI18N + btnTimePicker.setToolTipText("time picker"); + btnTimePicker.setBorderPainted(false); + btnTimePicker.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + btnTimePicker.setEnabled(false); + btnTimePicker.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnTimePickerActionPerformed(evt); + } + }); - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - if (value instanceof Boolean aBoolean) { - checkBox.setSelected(aBoolean); - checkBox.setHorizontalAlignment(CENTER); + toggleAutoBackup.setText("Auto Backup"); + toggleAutoBackup.setToolTipText("Enable/Disable automatic backup"); + toggleAutoBackup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + toggleAutoBackup.setPreferredSize(new java.awt.Dimension(108, 27)); + toggleAutoBackup.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + toggleAutoBackupActionPerformed(evt); + } + }); - if (row % 2 == 0) { - checkBox.setBackground(new Color(223, 222, 243)); - } else { - checkBox.setBackground(Color.WHITE); - } + jPanel3.setMaximumSize(new java.awt.Dimension(100, 100)); + jPanel3.setMinimumSize(new java.awt.Dimension(100, 100)); + jPanel3.setPreferredSize(new java.awt.Dimension(100, 100)); - if (isSelected) { - checkBox.setBackground(table.getSelectionBackground()); - checkBox.setForeground(table.getSelectionForeground()); - } else { - checkBox.setForeground(Color.BLACK); - } + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 150, Short.MAX_VALUE) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); - return checkBox; - } - return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - } - }; + jPanel4.setMaximumSize(new java.awt.Dimension(100, 100)); + jPanel4.setPreferredSize(new java.awt.Dimension(100, 100)); - TableColumnModel columnModel = table.getColumnModel(); - for (int i = 0; i < columnModel.getColumnCount(); i++) { - columnModel.getColumn(i).setCellRenderer(renderer); - } + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 150, Short.MAX_VALUE) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); - columnModel.getColumn(4).setCellRenderer(checkboxRenderer); - columnModel.getColumn(4).setCellEditor(table.getDefaultEditor(Boolean.class)); - } - - private void MenuQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuQuitActionPerformed - Logger.logMessage("Event --> exit", Logger.LogLevel.INFO); - System.exit(EXIT_ON_CLOSE); - }//GEN-LAST:event_MenuQuitActionPerformed + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(SingleBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(toggleAutoBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(4, 4, 4) + .addComponent(btnTimePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(268, 268, 268)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(162, 162, 162) + .addComponent(currentFileLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(164, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(3, 3, 3) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(64, 64, 64) + .addComponent(txtTitle)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(startPathField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(5, 5, 5) + .addComponent(btnPathSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(destinationPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 423, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(5, 5, 5) + .addComponent(btnPathSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 462, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lastBackupLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 461, javax.swing.GroupLayout.PREFERRED_SIZE)))))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addGap(101, 101, 101) + .addComponent(currentFileLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 369, Short.MAX_VALUE) + .addComponent(SingleBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(10, 10, 10) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(toggleAutoBackup, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(2, 2, 2) + .addComponent(btnTimePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(21, 21, 21)) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(25, 25, 25) + .addComponent(txtTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(36, 36, 36) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(startPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnPathSearch1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(15, 15, 15) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(destinationPathField, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnPathSearch2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addComponent(lastBackupLabel) + .addGap(10, 10, 10) + .addComponent(jLabel2) + .addGap(10, 10, 10) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 571, Short.MAX_VALUE) + .addContainerGap()))) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) + .addContainerGap())))) + ); - private void MenuHistoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuHistoryActionPerformed - Logger.logMessage("Event --> history", Logger.LogLevel.INFO); - try { - new ProcessBuilder("notepad.exe", ConfigKey.RES_DIRECTORY_STRING.getValue() + ConfigKey.LOG_FILE_STRING.getValue()).start(); - } catch (IOException e) { - Logger.logMessage("Error opening history file.", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Error opening history file.", "Error", JOptionPane.ERROR_MESSAGE); - } - }//GEN-LAST:event_MenuHistoryActionPerformed + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.ipady = 129; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + jPanel1.add(jPanel5, gridBagConstraints); - private void MenuClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuClearActionPerformed - Clear(); - }//GEN-LAST:event_MenuClearActionPerformed + TabbedPane.addTab("BackupEntry", jPanel1); - private void Clear() { - Logger.logMessage("Event --> clear", Logger.LogLevel.INFO); - - if (!saveChanged) { - int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to clean the fields?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (response != JOptionPane.YES_OPTION) { - return; + tablePanel.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + tablePanelMouseClicked(evt); } - } - - startPathField.setText(""); - destinationPathField.setText(""); - lastBackupLabel.setText(""); - backupNoteTextArea.setText(""); - } - - private void RemoveBackup(String backupName) { - Logger.logMessage("Event --> removing backup", Logger.LogLevel.INFO); + }); - // backup list update - for (Backup backup : backups) { - if (backupName.equals(backup.getBackupName())) { - backups.remove(backup); - break; + addBackupEntryButton.setForeground(new java.awt.Color(0, 0, 0)); + addBackupEntryButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/plus.png"))); // NOI18N + addBackupEntryButton.setToolTipText("Add new backup"); + addBackupEntryButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + addBackupEntryButton.setPreferredSize(new java.awt.Dimension(25, 25)); + addBackupEntryButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addBackupEntryButtonActionPerformed(evt); } - } - - BackupOperations.updateBackupList(backups); - } - - private void MenuSaveWithNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSaveWithNameActionPerformed - SaveWithName(); - }//GEN-LAST:event_MenuSaveWithNameActionPerformed + }); - private void MenuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSaveActionPerformed - saveFile(); - }//GEN-LAST:event_MenuSaveActionPerformed + table.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { - private void saveFile() { - Logger.logMessage("Event --> saving backup", Logger.LogLevel.INFO); - - if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) { - SaveWithName(); - } + }, + new String [] { + "Backup name", "Initial path", "Destination path", "Last backup", "Auto backup", "Next date backup", "Days interval backup" + } + ) { + Class[] types = new Class [] { + java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Boolean.class, java.lang.String.class, java.lang.Integer.class + }; + boolean[] canEdit = new boolean [] { + false, false, false, false, false, false, false + }; - try { - currentBackup.setInitialPath(GetStartPathField()); - currentBackup.setDestinationPath(GetDestinationPathField()); - currentBackup.setNotes(GetNotesTextArea()); - - LocalDateTime dateNow = LocalDateTime.now(); - currentBackup.setLastUpdateDate(dateNow); - - for (Backup b : backups) { - if (b.getBackupName().equals(currentBackup.getBackupName())) { - b.UpdateBackup(currentBackup); - break; - } + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; } - BackupOperations.updateBackupList(backups); - savedChanges(true); - } catch (IllegalArgumentException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); - } - } - - private void OpenBackup(String backupName) { - Logger.logMessage("Event --> opening backup", Logger.LogLevel.INFO); - - if (!saveChanged) { - int response = JOptionPane.showConfirmDialog(null, "There are unsaved changes, do you want to save them before moving to another file?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (response == JOptionPane.YES_OPTION) { - saveFile(); - } else if (response == JOptionPane.CANCEL_OPTION) { - return; + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; } - } - - try { - for(Backup backup : backups) { - if (backup.getBackupName().equals(backupName)) { - currentBackup = backup; - break; - } + }); + table.setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR)); + table.setRowHeight(50); + table.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + tableMouseClicked(evt); } - - updateCurrentFiedsByBackup(currentBackup); - backupNoteTextArea.setEnabled(true); - savedChanges(true); - } catch (IllegalArgumentException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); - } - } - - private void MenuNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuNewActionPerformed - NewBackup(); - }//GEN-LAST:event_MenuNewActionPerformed + }); + jScrollPane1.setViewportView(table); - private void updateCurrentFiedsByBackup(Backup backup) { - SetStartPathField(backup.getInitialPath()); - SetDestinationPathField(backup.getDestinationPath()); - SetLastBackupLabel(backup.getLastUpdateDate()); - setAutoBackupPreference(backup.isAutoBackup()); - setCurrentBackupName(backup.getBackupName()); - setCurrentBackupNotes(backup.getNotes()); - - if (backup.getTimeIntervalBackup() != null) { - btnTimePicker.setToolTipText(backup.getTimeIntervalBackup().toString()); - btnTimePicker.setEnabled(true); - } else { - btnTimePicker.setToolTipText(""); - btnTimePicker.setEnabled(false); - } - } - - private void NewBackup() { - Logger.logMessage("Event --> new backup", Logger.LogLevel.INFO); - - if (!saveChanged && !currentBackup.getBackupName().isEmpty()) { - int response = JOptionPane.showConfirmDialog(null, "There are unsaved changes, do you want to save them before moving to another backup?", "Confimation required", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); - if (response == JOptionPane.YES_OPTION) { - saveFile(); - } else if (response == JOptionPane.CANCEL_OPTION) { - return; - } - } - - Clear(); - currentBackup = new Backup(); - currentBackup.setAutoBackup(false); - currentBackup.setBackupName(""); - - // basic auto enable is disabled - setAutoBackupPreference(currentBackup.isAutoBackup()); + jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 20)); // NOI18N + jLabel1.setText("|"); + jLabel1.setAlignmentY(0.0F); - // I remove the current open backup - setCurrentBackupName("untitled*"); - } - - private void SingleBackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SingleBackupActionPerformed - SingleBackup(startPathField.getText(), destinationPathField.getText()); - }//GEN-LAST:event_SingleBackupActionPerformed + researchField.setToolTipText("Research bar"); + researchField.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyTyped(java.awt.event.KeyEvent evt) { + researchFieldKeyTyped(evt); + } + }); - private void pathSearchWithFileChooser(JTextField textField, boolean allowFiles) { - JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory()); - - if (allowFiles) - jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - else - jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + javax.swing.GroupLayout tablePanelLayout = new javax.swing.GroupLayout(tablePanel); + tablePanel.setLayout(tablePanelLayout); + tablePanelLayout.setHorizontalGroup( + tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tablePanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tablePanelLayout.createSequentialGroup() + .addComponent(addBackupEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(researchField, javax.swing.GroupLayout.PREFERRED_SIZE, 321, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(tablePanelLayout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 763, Short.MAX_VALUE) + .addContainerGap()))) + ); + tablePanelLayout.setVerticalGroup( + tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tablePanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(addBackupEntryButton, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(tablePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(researchField, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE) + .addContainerGap()) + ); - int returnValue = jfc.showSaveDialog(null); - if (returnValue == JFileChooser.APPROVE_OPTION) { - File selectedFile = jfc.getSelectedFile(); + researchField.getAccessibleContext().setAccessibleName(""); - // Logga il tipo di elemento selezionato - if (selectedFile.isDirectory()) { - Logger.logMessage("You selected the directory: " + selectedFile, Logger.LogLevel.INFO); - } else if (selectedFile.isFile()) { - Logger.logMessage("You selected the file: " + selectedFile, Logger.LogLevel.INFO); - } + detailsLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); - // Imposta il percorso nel campo di testo - textField.setText(selectedFile.toString()); - } - savedChanges(false); - } - - private void researchInTable() { - List tempBackups = new ArrayList<>(); - - String research = researchField.getText(); - - for (Backup backup : backups) { - if (backup.getBackupName().contains(research) || - backup.getInitialPath().contains(research) || - backup.getDestinationPath().contains(research) || - (backup.getLastBackup() != null && backup.getLastBackup().toString().contains(research)) || - (backup.getNextDateBackup() != null && backup.getNextDateBackup().toString().contains(research)) || - (backup.getTimeIntervalBackup() != null && backup.getTimeIntervalBackup().toString().contains(research))) { - tempBackups.add(backup); - } - } - - BackupOperations.updateTableWithNewBackupList(tempBackups); - } - - private void EditPoputItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditPoputItemActionPerformed - if (selectedRow != -1) { - Logger.logMessage("Edit row : " + selectedRow, Logger.LogLevel.INFO); - OpenBackup(backups.get(selectedRow).getBackupName()); - TabbedPane.setSelectedIndex(0); - } - }//GEN-LAST:event_EditPoputItemActionPerformed + javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); + detailsPanel.setLayout(detailsPanelLayout); + detailsPanelLayout.setHorizontalGroup( + detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailsPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(detailsLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + detailsPanelLayout.setVerticalGroup( + detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(detailsPanelLayout.createSequentialGroup() + .addComponent(detailsLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); - private void DeletePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeletePopupItemActionPerformed - Logger.logMessage("Event --> deleting backup", Logger.LogLevel.INFO); - - if (selectedRow != -1) { - int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this item? Please note, this action cannot be undone", "Confirmation required", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (response == JOptionPane.YES_OPTION) { - RemoveBackup(backups.get(selectedRow).getBackupName()); - } - } - }//GEN-LAST:event_DeletePopupItemActionPerformed + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(detailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tablePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); - private void addBackupEntryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBackupEntryButtonActionPerformed - TabbedPane.setSelectedIndex(0); - NewBackup(); - }//GEN-LAST:event_addBackupEntryButtonActionPerformed + TabbedPane.addTab("BackupList", jPanel2); - private void researchFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_researchFieldKeyTyped - researchInTable(); - }//GEN-LAST:event_researchFieldKeyTyped + jLabel3.setText("Version 2.0.2"); - private void tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseClicked - selectedRow = table.rowAtPoint(evt.getPoint()); // get index of the row + jMenu1.setText("File"); - if (selectedRow == -1) { // if clicked outside valid rows - table.clearSelection(); // deselect any selected row - detailsLabel.setText(""); // clear the label - } else { - // Handling right mouse button click - if (SwingUtilities.isRightMouseButton(evt)) { - AutoBackupMenuItem.setSelected(backups.get(selectedRow).isAutoBackup()); - table.setRowSelectionInterval(selectedRow, selectedRow); // select clicked row - TablePopup.show(evt.getComponent(), evt.getX(), evt.getY()); // show popup + MenuNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + MenuNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/add-file.png"))); // NOI18N + MenuNew.setText("New"); + MenuNew.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuNewActionPerformed(evt); } + }); + jMenu1.add(MenuNew); - // Handling left mouse button double-click - else if (SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2) { - Logger.logMessage("Edit row : " + selectedRow, Logger.LogLevel.INFO); - OpenBackup(backups.get(selectedRow).getBackupName()); - TabbedPane.setSelectedIndex(0); + MenuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + MenuSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/diskette.png"))); // NOI18N + MenuSave.setText("Save"); + MenuSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuSaveActionPerformed(evt); } + }); + jMenu1.add(MenuSave); - // Handling single left mouse button click - else if (SwingUtilities.isLeftMouseButton(evt)) { - detailsLabel.setText( - "BackupName: " + backups.get(selectedRow).getBackupName() + ", " + - "InitialPath: " + backups.get(selectedRow).getInitialPath() + ", " + - "DestinationPath: " + backups.get(selectedRow).getDestinationPath() + ", " + - "LastBackup: " + (backups.get(selectedRow).getLastBackup() != null ? backups.get(selectedRow).getLastBackup().format(formatter) : "") + ", " + - "NextBackup: " + (backups.get(selectedRow).getNextDateBackup() != null ? backups.get(selectedRow).getNextDateBackup().format(formatter) : "_") + ", " + - "TimeIntervalBackup: " + (backups.get(selectedRow).getTimeIntervalBackup() != null ? backups.get(selectedRow).getTimeIntervalBackup().toString() : "_") + ", " + - "CreationDate: " + (backups.get(selectedRow).getCreationDate() != null ? backups.get(selectedRow).getCreationDate().format(formatter) : "_") + ", " + - "LastUpdateDate: " + (backups.get(selectedRow).getLastUpdateDate() != null ? backups.get(selectedRow).getLastUpdateDate().format(formatter) : "_") + ", " + - "BackupCount: " + (backups.get(selectedRow).getBackupCount()) + ", " + - "Notes: " + (backups.get(selectedRow).getNotes()) + - "" - ); + MenuSaveWithName.setText("Save with name"); + MenuSaveWithName.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuSaveWithNameActionPerformed(evt); } - } - }//GEN-LAST:event_tableMouseClicked - - private void tablePanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablePanelMouseClicked - table.clearSelection(); // deselect any selected row - detailsLabel.setText(""); // clear the label - }//GEN-LAST:event_tablePanelMouseClicked - - private void DuplicatePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DuplicatePopupItemActionPerformed - Logger.logMessage("Event --> duplicating backup", Logger.LogLevel.INFO); - - if (selectedRow != -1) { - Backup backup = backups.get(selectedRow); - LocalDateTime dateNow = LocalDateTime.now(); - Backup newBackup = new Backup( - backup.getBackupName() + "_copy", - backup.getInitialPath(), - backup.getDestinationPath(), - null, - backup.isAutoBackup(), - backup.getNextDateBackup(), - backup.getTimeIntervalBackup(), - backup.getNotes(), - dateNow, - dateNow, - 0 - ); - - backups.add(newBackup); - BackupOperations.updateBackupList(backups); - } - }//GEN-LAST:event_DuplicatePopupItemActionPerformed + }); + jMenu1.add(MenuSaveWithName); - private void RunBackupPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RunBackupPopupItemActionPerformed - if (selectedRow != -1) { - - Backup backup = backups.get(selectedRow); - - progressBar = new BackupProgressGUI(backup.getInitialPath(), backup.getDestinationPath()); - progressBar.setVisible(true); - BackupOperations.SingleBackup(backup, null, progressBar); - - // if the backup is currentBackup - if (currentBackup.getBackupName().equals(backup.getBackupName())) - currentBackup.UpdateBackup(backup); + MenuClear.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + MenuClear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/clean.png"))); // NOI18N + MenuClear.setText("Clear"); + MenuClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuClearActionPerformed(evt); } - }//GEN-LAST:event_RunBackupPopupItemActionPerformed - - private void CopyBackupNamePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyBackupNamePopupItemActionPerformed - if (selectedRow != -1) { - StringSelection selection = new StringSelection(backups.get(selectedRow).getBackupName()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); - } - }//GEN-LAST:event_CopyBackupNamePopupItemActionPerformed - - private void CopyInitialPathPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyInitialPathPopupItemActionPerformed - if (selectedRow != -1) { - StringSelection selection = new StringSelection(backups.get(selectedRow).getInitialPath()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); - } - }//GEN-LAST:event_CopyInitialPathPopupItemActionPerformed - - private void CopyDestinationPathPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyDestinationPathPopupItemActionPerformed - if (selectedRow != -1) { - StringSelection selection = new StringSelection(backups.get(selectedRow).getDestinationPath()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); - } - }//GEN-LAST:event_CopyDestinationPathPopupItemActionPerformed + }); + jMenu1.add(MenuClear); - private void AutoBackupMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AutoBackupMenuItemActionPerformed - if (selectedRow != -1) { - Backup backup = backups.get(selectedRow); - boolean res = !backup.isAutoBackup(); - setAutoBackupPreference(backup, res); - AutoBackupMenuItem.setSelected(res); - if (res) { - AutomaticBackup(backup); + MenuHistory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/clock.png"))); // NOI18N + MenuHistory.setText("History"); + MenuHistory.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuHistoryActionPerformed(evt); } - } - }//GEN-LAST:event_AutoBackupMenuItemActionPerformed - - private void disableAutoBackup(Backup backup) { - Logger.logMessage("Event --> auto backup disabled", Logger.LogLevel.INFO); - - backup.setTimeIntervalBackup(null); - backup.setNextDateBackup(null); - backup.setLastUpdateDate(LocalDateTime.now()); - BackupOperations.updateBackupList(backups); - - // if the backup is the current backup i have to update the main panel - if (backup.getBackupName().equals(currentBackup.getBackupName())) { - btnTimePicker.setToolTipText(""); - btnTimePicker.setEnabled(false); - } - } - - private void OpenInitialFolderItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenInitialFolderItemActionPerformed - if (selectedRow != -1) { - OpenFolder(backups.get(selectedRow).getInitialPath()); - } - }//GEN-LAST:event_OpenInitialFolderItemActionPerformed - - private void OpenInitialDestinationItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenInitialDestinationItemActionPerformed - if (selectedRow != -1) { - OpenFolder(backups.get(selectedRow).getDestinationPath()); - } - }//GEN-LAST:event_OpenInitialDestinationItemActionPerformed - - private void renamePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renamePopupItemActionPerformed - if (selectedRow != -1) { - renameBackup(backups.get(selectedRow)); - } - }//GEN-LAST:event_renamePopupItemActionPerformed - - private void MenuDonateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuDonateActionPerformed - Logger.logMessage("Event --> donate", Logger.LogLevel.INFO); - openWebSite(ConfigKey.DONATE_PAGE_LINK.getValue()); - }//GEN-LAST:event_MenuDonateActionPerformed + }); + jMenu1.add(MenuHistory); - private void MenuBugReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuBugReportActionPerformed - Logger.logMessage("Event --> bug report", Logger.LogLevel.INFO); - openWebSite(ConfigKey.ISSUE_PAGE_LINK.getValue()); - }//GEN-LAST:event_MenuBugReportActionPerformed + jMenuBar1.add(jMenu1); - private void MenuShareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuShareActionPerformed - Logger.logMessage("Event --> share", Logger.LogLevel.INFO); + jMenu2.setText("Options"); - // pop-up message - JOptionPane.showMessageDialog(null, "Share link copied to clipboard!"); + MenuBugReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/bug.png"))); // NOI18N + MenuBugReport.setText("Report a bug"); + MenuBugReport.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuBugReportActionPerformed(evt); + } + }); + jMenu2.add(MenuBugReport); - // copy link to the clipboard - StringSelection stringSelectionObj = new StringSelection(ConfigKey.SHARE_LINK.getValue()); - Clipboard clipboardObj = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboardObj.setContents(stringSelectionObj, null); - }//GEN-LAST:event_MenuShareActionPerformed - - private void toggleAutoBackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toggleAutoBackupActionPerformed - Logger.logMessage("Event --> auto backup preference", Logger.LogLevel.INFO); - - // checks - if (!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(),startPathField.getText(), destinationPathField.getText(), null)) { - toggleAutoBackup.setSelected(false); - return; - } - if (currentBackup.isAutoBackup()) { - int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to cancel automatic backup?", "Confimation required", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); - if (response != JOptionPane.YES_OPTION) { - toggleAutoBackup.setSelected(true); - return; - } - } - - boolean enabled = toggleAutoBackup.isSelected(); - if (enabled && AutomaticBackup()) { - Logger.logMessage("Event --> Auto Backup setted to Enabled", Logger.LogLevel.INFO); - toggleAutoBackup.setSelected(true); - } - else { - Logger.logMessage("Event --> Auto Backup setted to Disabled", Logger.LogLevel.INFO); - disableAutoBackup(currentBackup); - toggleAutoBackup.setSelected(false); - } - - toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); - currentBackup.setAutoBackup(enabled); - BackupOperations.updateBackupList(backups); - }//GEN-LAST:event_toggleAutoBackupActionPerformed + MenuQuit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_DOWN_MASK)); + MenuQuit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/remove.png"))); // NOI18N + MenuQuit.setText("Quit"); + MenuQuit.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuQuitActionPerformed(evt); + } + }); + jMenu2.add(MenuQuit); - private void MenuWebsiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuWebsiteActionPerformed - Logger.logMessage("Event --> shard website", Logger.LogLevel.INFO); - openWebSite(ConfigKey.SHARD_WEBSITE.getValue()); - }//GEN-LAST:event_MenuWebsiteActionPerformed + jMenuBar1.add(jMenu2); - private void MenuSupportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSupportActionPerformed - Logger.logMessage("Event --> support", Logger.LogLevel.INFO); - - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); + jMenu3.setText("About"); - if (desktop.isSupported(Desktop.Action.MAIL)) { - String subject = "Support - Auto Backup Program"; - String mailTo = "mailto:" + ConfigKey.EMAIL.getValue() + "?subject=" + encodeURI(subject); + MenuShare.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/share.png"))); // NOI18N + MenuShare.setText("Share"); + MenuShare.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuShareActionPerformed(evt); + } + }); + jMenu3.add(MenuShare); - try { - URI uri = new URI(mailTo); - desktop.mail(uri); - } catch (IOException | URISyntaxException ex) { - Logger.logMessage("Failed to send email: " + ex.getMessage(), Logger.LogLevel.ERROR, ex); - JOptionPane.showMessageDialog(null, "Unable to send email. Please try again later.", "Error", JOptionPane.ERROR_MESSAGE); - } - } else { - Logger.logMessage("Mail action is unsupported in your system's desktop environment.", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Your system does not support sending emails directly from this application.", "Error", JOptionPane.ERROR_MESSAGE); + MenuDonate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/donation.png"))); // NOI18N + MenuDonate.setText("Donate"); + MenuDonate.setEnabled(false); + MenuDonate.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuDonateActionPerformed(evt); } - } else { - Logger.logMessage("Desktop integration is unsupported on this system.", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Your system does not support sending emails.", "Error", JOptionPane.ERROR_MESSAGE); - } - }//GEN-LAST:event_MenuSupportActionPerformed + }); + jMenu3.add(MenuDonate); - // Method to properly encode the URI with special characters (spaces, symbols, etc.) - private static String encodeURI(String value) { - try { - return java.net.URLEncoder.encode(value, "UTF-8").replace("+", "%20"); - } catch (IOException e) { - return value; // If encoding fails, return the original value - } - } - - private void MenuInfoPageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuInfoPageActionPerformed - Logger.logMessage("Event --> shard website", Logger.LogLevel.INFO); - openWebSite(ConfigKey.INFO_PAGE_LINK.getValue()); - }//GEN-LAST:event_MenuInfoPageActionPerformed + MenuInfoPage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/info.png"))); // NOI18N + MenuInfoPage.setText("Info"); + MenuInfoPage.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuInfoPageActionPerformed(evt); + } + }); + jMenu3.add(MenuInfoPage); - private void btnPathSearch2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPathSearch2ActionPerformed - pathSearchWithFileChooser(destinationPathField, false); - }//GEN-LAST:event_btnPathSearch2ActionPerformed + jMenuBar1.add(jMenu3); - private void btnPathSearch1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPathSearch1ActionPerformed - pathSearchWithFileChooser(startPathField, true); - }//GEN-LAST:event_btnPathSearch1ActionPerformed + jMenu5.setText("Help"); - private void btnTimePickerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTimePickerActionPerformed - TimeInterval timeInterval = openTimePicker(currentBackup.getTimeIntervalBackup()); + MenuWebsite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/website.png"))); // NOI18N + MenuWebsite.setText("Website"); + MenuWebsite.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuWebsiteActionPerformed(evt); + } + }); + jMenu5.add(MenuWebsite); - if (timeInterval == null) return; + MenuSupport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/img/help-desk.png"))); // NOI18N + MenuSupport.setText("Support"); + MenuSupport.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + MenuSupportActionPerformed(evt); + } + }); + jMenu5.add(MenuSupport); - btnTimePicker.setToolTipText(timeInterval.toString()); - LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) - .plusHours(timeInterval.getHours()) - .plusMinutes(timeInterval.getMinutes()); + jMenuBar1.add(jMenu5); - currentBackup.setTimeIntervalBackup(timeInterval); - currentBackup.setNextDateBackup(nextDateBackup); + setJMenuBar(jMenuBar1); - currentBackup.setInitialPath(GetStartPathField()); - currentBackup.setDestinationPath(GetDestinationPathField()); - for (Backup b : backups) { - if (b.getBackupName().equals(currentBackup.getBackupName())) { - b.UpdateBackup(currentBackup); - break; - } - } - BackupOperations.updateBackupList(backups); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(TabbedPane, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(TabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 636, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE) + .addComponent(jLabel3) + .addContainerGap()) + ); - JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + startPathField.getText() + "\n\tTo: " + destinationPathField.getText() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); - }//GEN-LAST:event_btnTimePickerActionPerformed - - private TimeInterval openTimePicker(TimeInterval time) { - TimePicker picker = new TimePicker(this, time, true); - picker.setVisible(true); - return picker.getTimeInterval(); - } - - private void renameBackup(Backup backup) { - Logger.logMessage("Event --> backup renaming", Logger.LogLevel.INFO); - - String backup_name = getBackupName(false); - if (backup_name == null || backup_name.isEmpty()) return; - - backup.setBackupName(backup_name); - backup.setLastUpdateDate(LocalDateTime.now()); - BackupOperations.updateBackupList(backups); - } - - private void OpenFolder(String path) { - Logger.logMessage("Event --> opening folder", Logger.LogLevel.INFO); - - File folder = new File(path); - if (folder.exists() && folder.isDirectory()) { - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - try { - desktop.open(folder); - } catch (IOException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); - } - } else { - Logger.logMessage("Desktop not supported on this operating system", Logger.LogLevel.WARN); - } - } else { - Logger.logMessage("The folder does not exist or is invalid", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "The folder does not exist or is invalid", "Error", JOptionPane.ERROR_MESSAGE); - } - } - - private void savedChanges(boolean saved) { - if (saved || currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty() || (currentBackup.getInitialPath().equals(startPathField.getText())) && currentBackup.getDestinationPath().equals(destinationPathField.getText()) && currentBackup.getNotes().equals(backupNoteTextArea.getText())) { - setCurrentBackupName(currentBackup.getBackupName()); - } else { - setCurrentBackupName(currentBackup.getBackupName() + "*"); - } - saveChanged = saved; - } - - public void setAutoBackupPreference(boolean option) { - toggleAutoBackup.setSelected(option); - toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); - currentBackup.setAutoBackup(option); - - if (!option) { - disableAutoBackup(currentBackup); - } - } - - public void setAutoBackupPreference(Backup backup, boolean option) { - backup.setAutoBackup(option); - if (backup.getBackupName().equals(currentBackup.getBackupName())) { - toggleAutoBackup.setSelected(option); - } - if (!option) { - disableAutoBackup(backup); - } - toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); - } - - // it returns true if is correctly setted, false otherwise - public boolean AutomaticBackup() { - Logger.logMessage("Event --> automatic backup", Logger.LogLevel.INFO); - - if(!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(),startPathField.getText(), destinationPathField.getText(), null)) return false; + pack(); + setLocationRelativeTo(null); + }// //GEN-END:initComponents - // if the file has not been saved you need to save it before setting the auto backup - if(currentBackup.isAutoBackup() == false || currentBackup.getNextDateBackup() == null || currentBackup.getTimeIntervalBackup() == null) { - if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) SaveWithName(); - if (currentBackup.getBackupName() == null || currentBackup.getBackupName().isEmpty()) return false; + private void MenuQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuQuitActionPerformed + Logger.logMessage("Event --> exit", Logger.LogLevel.INFO); + System.exit(EXIT_ON_CLOSE); + }//GEN-LAST:event_MenuQuitActionPerformed - // message - TimeInterval timeInterval = openTimePicker(null); - if (timeInterval == null) return false; + private void MenuHistoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuHistoryActionPerformed + Logger.logMessage("Event --> history", Logger.LogLevel.INFO); + try { + new ProcessBuilder("notepad.exe", ConfigKey.RES_DIRECTORY_STRING.getValue() + ConfigKey.LOG_FILE_STRING.getValue()).start(); + } catch (IOException e) { + Logger.logMessage("Error opening history file.", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Error opening history file.", "Error", JOptionPane.ERROR_MESSAGE); + } + }//GEN-LAST:event_MenuHistoryActionPerformed - //set date for next backup - LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) - .plusHours(timeInterval.getHours()) - .plusMinutes(timeInterval.getMinutes()); + private void MenuClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuClearActionPerformed + Clear(); + }//GEN-LAST:event_MenuClearActionPerformed - currentBackup.setTimeIntervalBackup(timeInterval); - currentBackup.setNextDateBackup(nextDateBackup); - btnTimePicker.setToolTipText(timeInterval.toString()); - btnTimePicker.setEnabled(true); + private void MenuSaveWithNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSaveWithNameActionPerformed + SaveWithName(); + }//GEN-LAST:event_MenuSaveWithNameActionPerformed - Logger.logMessage("Event --> Next date backup setted to " + nextDateBackup, Logger.LogLevel.INFO); - JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + startPathField.getText() + "\n\tTo: " + destinationPathField.getText() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); + private void MenuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSaveActionPerformed + saveFile(); + }//GEN-LAST:event_MenuSaveActionPerformed + + private void MenuNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuNewActionPerformed + NewBackup(); + }//GEN-LAST:event_MenuNewActionPerformed + + private void SingleBackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SingleBackupActionPerformed + SingleBackup(startPathField.getText(), destinationPathField.getText()); + }//GEN-LAST:event_SingleBackupActionPerformed + + private void EditPoputItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditPoputItemActionPerformed + if (selectedRow != -1) { + Logger.logMessage("Edit row : " + selectedRow, Logger.LogLevel.INFO); + OpenBackup(backups.get(selectedRow).getBackupName()); + TabbedPane.setSelectedIndex(0); } + }//GEN-LAST:event_EditPoputItemActionPerformed - currentBackup.setInitialPath(GetStartPathField()); - currentBackup.setDestinationPath(GetDestinationPathField()); - for (Backup b : backups) { - if (b.getBackupName().equals(currentBackup.getBackupName())) { - b.UpdateBackup(currentBackup); - break; + private void DeletePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeletePopupItemActionPerformed + Logger.logMessage("Event --> deleting backup", Logger.LogLevel.INFO); + + if (selectedRow != -1) { + int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this item? Please note, this action cannot be undone", "Confirmation required", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + if (response == JOptionPane.YES_OPTION) { + RemoveBackup(backups.get(selectedRow).getBackupName()); } } - BackupOperations.updateBackupList(backups); - return true; - } - - public boolean AutomaticBackup(Backup backup) { - Logger.logMessage("Event --> automatic backup", Logger.LogLevel.INFO); - - if(!BackupOperations.CheckInputCorrect(backup.getBackupName(), backup.getInitialPath(), backup.getDestinationPath(), null)) return false; - - if(backup.isAutoBackup() == false || backup.getNextDateBackup() == null || backup.getTimeIntervalBackup() == null) { - // if the file has not been saved you need to save it before setting the auto backup - if (backup.getBackupName() == null || backup.getBackupName().isEmpty()) SaveWithName(); - if (backup.getBackupName() == null || backup.getBackupName().isEmpty()) return false; + }//GEN-LAST:event_DeletePopupItemActionPerformed - // message - TimeInterval timeInterval = openTimePicker(null); - if (timeInterval == null) return false; + private void addBackupEntryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBackupEntryButtonActionPerformed + TabbedPane.setSelectedIndex(0); + NewBackup(); + }//GEN-LAST:event_addBackupEntryButtonActionPerformed - //set date for next backup - LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) - .plusHours(timeInterval.getHours()) - .plusMinutes(timeInterval.getMinutes()); + private void researchFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_researchFieldKeyTyped + researchInTable(); + }//GEN-LAST:event_researchFieldKeyTyped - backup.setTimeIntervalBackup(timeInterval); - backup.setNextDateBackup(nextDateBackup); - btnTimePicker.setToolTipText(timeInterval.toString()); - btnTimePicker.setEnabled(true); + private void tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseClicked + selectedRow = table.rowAtPoint(evt.getPoint()); // get index of the row - Logger.logMessage("Event --> Next date backup setted to " + nextDateBackup, Logger.LogLevel.INFO); - JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + backup.getInitialPath() + "\n\tTo: " + backup.getDestinationPath() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); - } + if (selectedRow == -1) { // if clicked outside valid rows + table.clearSelection(); // deselect any selected row + detailsLabel.setText(""); // clear the label + } else { + // Handling right mouse button click + if (SwingUtilities.isRightMouseButton(evt)) { + AutoBackupMenuItem.setSelected(backups.get(selectedRow).isAutoBackup()); + table.setRowSelectionInterval(selectedRow, selectedRow); // select clicked row + TablePopup.show(evt.getComponent(), evt.getX(), evt.getY()); // show popup + } - for (Backup b : backups) { - if (b.getBackupName().equals(backup.getBackupName())) { - b.UpdateBackup(backup); - break; + // Handling left mouse button double-click + else if (SwingUtilities.isLeftMouseButton(evt) && evt.getClickCount() == 2) { + Logger.logMessage("Edit row : " + selectedRow, Logger.LogLevel.INFO); + OpenBackup(backups.get(selectedRow).getBackupName()); + TabbedPane.setSelectedIndex(0); + } + + // Handling single left mouse button click + else if (SwingUtilities.isLeftMouseButton(evt)) { + detailsLabel.setText( + "BackupName: " + backups.get(selectedRow).getBackupName() + ", " + + "InitialPath: " + backups.get(selectedRow).getInitialPath() + ", " + + "DestinationPath: " + backups.get(selectedRow).getDestinationPath() + ", " + + "LastBackup: " + (backups.get(selectedRow).getLastBackup() != null ? backups.get(selectedRow).getLastBackup().format(formatter) : "") + ", " + + "NextBackup: " + (backups.get(selectedRow).getNextDateBackup() != null ? backups.get(selectedRow).getNextDateBackup().format(formatter) : "_") + ", " + + "TimeIntervalBackup: " + (backups.get(selectedRow).getTimeIntervalBackup() != null ? backups.get(selectedRow).getTimeIntervalBackup().toString() : "_") + ", " + + "CreationDate: " + (backups.get(selectedRow).getCreationDate() != null ? backups.get(selectedRow).getCreationDate().format(formatter) : "_") + ", " + + "LastUpdateDate: " + (backups.get(selectedRow).getLastUpdateDate() != null ? backups.get(selectedRow).getLastUpdateDate().format(formatter) : "_") + ", " + + "BackupCount: " + (backups.get(selectedRow).getBackupCount()) + ", " + + "Notes: " + (backups.get(selectedRow).getNotes()) + + "" + ); } } - - // if the backup is currentBackup - if (currentBackup.getBackupName().equals(backup.getBackupName())) - currentBackup.UpdateBackup(backup); - - BackupOperations.updateBackupList(backups); - return true; - } - - private void SaveWithName() { - Logger.logMessage("Event --> save with name", Logger.LogLevel.INFO); + }//GEN-LAST:event_tableMouseClicked - String backup_name = getBackupName(true); - - if (backup_name == null || backup_name.length() == 0) return; + private void tablePanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablePanelMouseClicked + table.clearSelection(); // deselect any selected row + detailsLabel.setText(""); // clear the label + }//GEN-LAST:event_tablePanelMouseClicked - try { + private void DuplicatePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DuplicatePopupItemActionPerformed + Logger.logMessage("Event --> duplicating backup", Logger.LogLevel.INFO); + + if (selectedRow != -1) { + Backup backup = backups.get(selectedRow); LocalDateTime dateNow = LocalDateTime.now(); - Backup backup = new Backup ( - backup_name, - GetStartPathField(), - GetDestinationPathField(), - currentBackup.getLastBackup(), - currentBackup.isAutoBackup(), - currentBackup.getNextDateBackup(), - currentBackup.getTimeIntervalBackup(), - GetNotesTextArea(), + Backup newBackup = new Backup( + backup.getBackupName() + "_copy", + backup.getInitialPath(), + backup.getDestinationPath(), + null, + backup.isAutoBackup(), + backup.getNextDateBackup(), + backup.getTimeIntervalBackup(), + backup.getNotes(), dateNow, dateNow, 0 ); - backups.add(backup); - currentBackup = backup; - + backups.add(newBackup); BackupOperations.updateBackupList(backups); - Logger.logMessage("Backup '" + currentBackup.getBackupName() + "' saved successfully!", Logger.LogLevel.INFO); - JOptionPane.showMessageDialog(this, "Backup '" + currentBackup.getBackupName() + "' saved successfully!", "Backup saved", JOptionPane.INFORMATION_MESSAGE); - savedChanges(true); - } catch (IllegalArgumentException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); - } catch (HeadlessException ex) { - Logger.logMessage("Error saving backup", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Error saving backup", "Error", JOptionPane.ERROR_MESSAGE); } - } - - private String getBackupName(boolean canOverwrite) { - String backup_name; - do { - backup_name = JOptionPane.showInputDialog(null, "Name of the backup"); // pop-up message - for (Backup backup : backups) { - if (backup.getBackupName().equals(backup_name) && canOverwrite) { - int response = JOptionPane.showConfirmDialog(null, "A backup with the same name already exists, do you want to overwrite it?", "Confimation required", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); - if (response == JOptionPane.YES_OPTION) { - backups.remove(backup); - break; - } else { - backup_name = null; - } - } else if (backup.getBackupName().equals(backup_name)) { - Logger.logMessage("Error saving backup", Logger.LogLevel.WARN); - JOptionPane.showConfirmDialog(null, "Backup name already used!", "Error", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE); - } + }//GEN-LAST:event_DuplicatePopupItemActionPerformed + + private void RunBackupPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RunBackupPopupItemActionPerformed + if (selectedRow != -1) { + + Backup backup = backups.get(selectedRow); + + progressBar = new BackupProgressGUI(backup.getInitialPath(), backup.getDestinationPath()); + progressBar.setVisible(true); + BackupOperations.SingleBackup(backup, null, progressBar); + + // if the backup is currentBackup + if (currentBackup.getBackupName().equals(backup.getBackupName())) + currentBackup.UpdateBackup(backup); } - if (backup_name == null) return null; - } while (backup_name.equals("null") || backup_name.equals("null*")); - if (backup_name.isEmpty()) return null; - return backup_name; - } - - public void SingleBackup(String path1, String path2) { - Logger.logMessage("Event --> single backup", Logger.LogLevel.INFO); - - String temp = "\\"; + }//GEN-LAST:event_RunBackupPopupItemActionPerformed - //------------------------------INPUT CONTROL ERRORS------------------------------ - if(!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(), path1, path2, null)) return; + private void CopyBackupNamePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyBackupNamePopupItemActionPerformed + if (selectedRow != -1) { + StringSelection selection = new StringSelection(backups.get(selectedRow).getBackupName()); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); + } + }//GEN-LAST:event_CopyBackupNamePopupItemActionPerformed - //------------------------------TO GET THE CURRENT DATE------------------------------ - LocalDateTime dateNow = LocalDateTime.now(); + private void CopyInitialPathPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyInitialPathPopupItemActionPerformed + if (selectedRow != -1) { + StringSelection selection = new StringSelection(backups.get(selectedRow).getInitialPath()); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); + } + }//GEN-LAST:event_CopyInitialPathPopupItemActionPerformed - //------------------------------SET ALL THE VARIABLES------------------------------ - String name1; // folder name/initial file - String date = dateNow.format(dateForfolderNameFormatter); + private void CopyDestinationPathPopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CopyDestinationPathPopupItemActionPerformed + if (selectedRow != -1) { + StringSelection selection = new StringSelection(backups.get(selectedRow).getDestinationPath()); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); + } + }//GEN-LAST:event_CopyDestinationPathPopupItemActionPerformed - //------------------------------SET ALL THE STRINGS------------------------------ - name1 = path1.substring(path1.length()-1, path1.length()-1); + private void AutoBackupMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AutoBackupMenuItemActionPerformed + if (selectedRow != -1) { + Backup backup = backups.get(selectedRow); + boolean res = !backup.isAutoBackup(); + setAutoBackupPreference(backup, res); + AutoBackupMenuItem.setSelected(res); + if (res) { + AutomaticBackup(backup); + } + } + }//GEN-LAST:event_AutoBackupMenuItemActionPerformed - for(int i=path1.length()-1; i>=0; i--) { - if(path1.charAt(i) != temp.charAt(0)) name1 = path1.charAt(i) + name1; - else break; + private void OpenInitialFolderItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenInitialFolderItemActionPerformed + if (selectedRow != -1) { + OpenFolder(backups.get(selectedRow).getInitialPath()); + } + }//GEN-LAST:event_OpenInitialFolderItemActionPerformed + + private void OpenInitialDestinationItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenInitialDestinationItemActionPerformed + if (selectedRow != -1) { + OpenFolder(backups.get(selectedRow).getDestinationPath()); + } + }//GEN-LAST:event_OpenInitialDestinationItemActionPerformed + + private void renamePopupItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renamePopupItemActionPerformed + if (selectedRow != -1) { + renameBackup(backups.get(selectedRow)); } + }//GEN-LAST:event_renamePopupItemActionPerformed + + private void MenuDonateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuDonateActionPerformed + Logger.logMessage("Event --> donate", Logger.LogLevel.INFO); + openWebSite(ConfigKey.DONATE_PAGE_LINK.getValue()); + }//GEN-LAST:event_MenuDonateActionPerformed - path2 = path2 + "\\" + name1 + " (Backup " + date + ")"; + private void MenuBugReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuBugReportActionPerformed + Logger.logMessage("Event --> bug report", Logger.LogLevel.INFO); + openWebSite(ConfigKey.ISSUE_PAGE_LINK.getValue()); + }//GEN-LAST:event_MenuBugReportActionPerformed - //------------------------------COPY THE FILE OR DIRECTORY------------------------------ - Logger.logMessage("date backup: " + date, Logger.LogLevel.INFO); - - try { - progressBar = new BackupProgressGUI(path1, path2); - progressBar.setVisible(true); - BackupOperations.zipDirectory(path1, path2+".zip", currentBackup, null, progressBar); - - //if current_file_opened is null it means they are not in a backup but it is a backup with no associated json file - if (currentBackup.getBackupName() != null && !currentBackup.getBackupName().isEmpty()) { - currentBackup.setInitialPath(GetStartPathField()); - currentBackup.setDestinationPath(GetDestinationPathField()); - currentBackup.setLastBackup(LocalDateTime.now()); + private void MenuShareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuShareActionPerformed + Logger.logMessage("Event --> share", Logger.LogLevel.INFO); - } - - } catch (IOException e) { - Logger.logMessage("Error during the backup operation: the initial path is incorrect!", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Error during the backup operation: the initial path is incorrect!", "Error", JOptionPane.ERROR_MESSAGE); - } - } - - private void setCurrentBackupName(String name) { - currentFileLabel.setText("Current File: " + name); - } + // pop-up message + JOptionPane.showMessageDialog(null, "Share link copied to clipboard!"); + + // copy link to the clipboard + StringSelection stringSelectionObj = new StringSelection(ConfigKey.SHARE_LINK.getValue()); + Clipboard clipboardObj = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboardObj.setContents(stringSelectionObj, null); + }//GEN-LAST:event_MenuShareActionPerformed - private void setCurrentBackupNotes(String notes) { - backupNoteTextArea.setText(notes); - } - - public void setStringToText() { - try { - String last_date = LocalDateTime.now().format(formatter); - lastBackupLabel.setText("last backup: " + last_date); - } catch(Exception ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + private void toggleAutoBackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toggleAutoBackupActionPerformed + Logger.logMessage("Event --> auto backup preference", Logger.LogLevel.INFO); + + // checks + if (!BackupOperations.CheckInputCorrect(currentBackup.getBackupName(),startPathField.getText(), destinationPathField.getText(), null)) { + toggleAutoBackup.setSelected(false); + return; } - } - - public void setTextValues() { - try { - updateCurrentFiedsByBackup(currentBackup); - } catch (IllegalArgumentException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); + if (currentBackup.isAutoBackup()) { + int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to cancel automatic backup?", "Confimation required", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (response != JOptionPane.YES_OPTION) { + toggleAutoBackup.setSelected(true); + return; + } + } + + boolean enabled = toggleAutoBackup.isSelected(); + if (enabled && AutomaticBackup()) { + Logger.logMessage("Event --> Auto Backup setted to Enabled", Logger.LogLevel.INFO); + toggleAutoBackup.setSelected(true); + } + else { + Logger.logMessage("Event --> Auto Backup setted to Disabled", Logger.LogLevel.INFO); + disableAutoBackup(currentBackup); + toggleAutoBackup.setSelected(false); } - setAutoBackupPreference(currentBackup.isAutoBackup()); - } - - private void customListeners() { - startPathField.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - savedChanges(false); - } - - @Override - public void removeUpdate(DocumentEvent e) {} - - @Override - public void changedUpdate(DocumentEvent e) {} - }); - destinationPathField.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - savedChanges(false); - } + toggleAutoBackup.setText(toggleAutoBackup.isSelected() ? backupOnText : backupOffText); + currentBackup.setAutoBackup(enabled); + BackupOperations.updateBackupList(backups); + }//GEN-LAST:event_toggleAutoBackupActionPerformed - @Override - public void removeUpdate(DocumentEvent e) {} + private void MenuWebsiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuWebsiteActionPerformed + Logger.logMessage("Event --> shard website", Logger.LogLevel.INFO); + openWebSite(ConfigKey.SHARD_WEBSITE.getValue()); + }//GEN-LAST:event_MenuWebsiteActionPerformed - @Override - public void changedUpdate(DocumentEvent e) {} - }); + private void MenuSupportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuSupportActionPerformed + Logger.logMessage("Event --> support", Logger.LogLevel.INFO); - backupNoteTextArea.getDocument().addDocumentListener(new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - savedChanges(false); - } + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); - @Override - public void removeUpdate(DocumentEvent e) {} + if (desktop.isSupported(Desktop.Action.MAIL)) { + String subject = "Support - Auto Backup Program"; + String mailTo = "mailto:" + ConfigKey.EMAIL.getValue() + "?subject=" + encodeURI(subject); - @Override - public void changedUpdate(DocumentEvent e) {} - }); - } - - public String GetStartPathField() { - return startPathField.getText(); - } - public String GetDestinationPathField() { - return destinationPathField.getText(); - } - public String GetNotesTextArea() { - return backupNoteTextArea.getText(); - } - public boolean GetAutomaticBackupPreference() { - return toggleAutoBackup.isSelected(); - } - public void SetStartPathField(String text) { - startPathField.setText(text); - } - public void SetDestinationPathField(String text) { - destinationPathField.setText(text); - } - public void SetLastBackupLabel(LocalDateTime date) { - if (date != null) { - String dateStr = date.format(formatter); - dateStr = "last backup: " + dateStr; - lastBackupLabel.setText(dateStr); + try { + URI uri = new URI(mailTo); + desktop.mail(uri); + } catch (IOException | URISyntaxException ex) { + Logger.logMessage("Failed to send email: " + ex.getMessage(), Logger.LogLevel.ERROR, ex); + JOptionPane.showMessageDialog(null, "Unable to send email. Please try again later.", "Error", JOptionPane.ERROR_MESSAGE); + } + } else { + Logger.logMessage("Mail action is unsupported in your system's desktop environment.", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Your system does not support sending emails directly from this application.", "Error", JOptionPane.ERROR_MESSAGE); + } + } else { + Logger.logMessage("Desktop integration is unsupported on this system.", Logger.LogLevel.WARN); + JOptionPane.showMessageDialog(null, "Your system does not support sending emails.", "Error", JOptionPane.ERROR_MESSAGE); } - else lastBackupLabel.setText(""); - } + }//GEN-LAST:event_MenuSupportActionPerformed - public static void OpenExceptionMessage(String errorMessage, String stackTrace) { - Object[] options = {"Close", "Copy to clipboard", "Report the Problem"}; + private void MenuInfoPageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuInfoPageActionPerformed + Logger.logMessage("Event --> shard website", Logger.LogLevel.INFO); + openWebSite(ConfigKey.INFO_PAGE_LINK.getValue()); + }//GEN-LAST:event_MenuInfoPageActionPerformed - if (errorMessage == null ) { - errorMessage = ""; - } - stackTrace = !errorMessage.isEmpty() ? errorMessage + "\n" + stackTrace : errorMessage + stackTrace; - String stackTraceMessage = "Please report this error, either with an image of the screen or by copying the following error text (it is appreciable to provide a description of the operations performed before the error): \n" + stackTrace; + private void btnPathSearch2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPathSearch2ActionPerformed + pathSearchWithFileChooser(destinationPathField, false); + }//GEN-LAST:event_btnPathSearch2ActionPerformed - int choice; + private void btnPathSearch1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPathSearch1ActionPerformed + pathSearchWithFileChooser(startPathField, true); + }//GEN-LAST:event_btnPathSearch1ActionPerformed - // Keep displaying the dialog until the "Close" option (index 0) is chosen - do { - if (stackTraceMessage.length() > 1500) { - stackTraceMessage = stackTraceMessage.substring(0, 1500) + "..."; - } - - // Display the option dialog - choice = JOptionPane.showOptionDialog( - null, - stackTraceMessage, // The detailed message or stack trace - "Error...", // The error message/title - JOptionPane.DEFAULT_OPTION, // Option type (default option type) - JOptionPane.ERROR_MESSAGE, // Message type (error message icon) - null, // Icon (null means default icon) - options, // The options for the buttons - options[0] // The default option (Close) - ); - - if (choice == 1) { - StringSelection selection = new StringSelection(stackTrace); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); - Logger.logMessage("Error text has been copied to the clipboard", Logger.LogLevel.INFO); - JOptionPane.showMessageDialog(null, "Error text has been copied to the clipboard."); - } else if (choice == 2) { - openWebSite(ConfigKey.ISSUE_PAGE_LINK.getValue()); - } - } while (choice == 1 || choice == 2); - } - - private static void openWebSite(String reportUrl) { - try { - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - if (desktop.isSupported(Desktop.Action.BROWSE)) { - desktop.browse(new URI(reportUrl)); - } + private void btnTimePickerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTimePickerActionPerformed + TimeInterval timeInterval = openTimePicker(currentBackup.getTimeIntervalBackup()); + + if (timeInterval == null) return; + + btnTimePicker.setToolTipText(timeInterval.toString()); + LocalDateTime nextDateBackup = LocalDateTime.now().plusDays(timeInterval.getDays()) + .plusHours(timeInterval.getHours()) + .plusMinutes(timeInterval.getMinutes()); + + currentBackup.setTimeIntervalBackup(timeInterval); + currentBackup.setNextDateBackup(nextDateBackup); + + currentBackup.setInitialPath(GetStartPathField()); + currentBackup.setDestinationPath(GetDestinationPathField()); + for (Backup b : backups) { + if (b.getBackupName().equals(currentBackup.getBackupName())) { + b.UpdateBackup(currentBackup); + break; } - } catch (IOException | URISyntaxException e) { - Logger.logMessage("Failed to open the web page. Please try again", Logger.LogLevel.WARN); - JOptionPane.showMessageDialog(null, "Failed to open the web page. Please try again.", "Error", JOptionPane.ERROR_MESSAGE); } - } + BackupOperations.updateBackupList(backups); + + JOptionPane.showMessageDialog(null, "Auto Backup has been activated\n\tFrom: " + startPathField.getText() + "\n\tTo: " + destinationPathField.getText() + "\nIs setted every " + timeInterval.toString() + " days", "AutoBackup", 1); + }//GEN-LAST:event_btnTimePickerActionPerformed public static void main(String args[]) { java.awt.EventQueue.invokeLater(() -> { diff --git a/src/main/java/com/mycompany/autobackupprogram/BackupOperations.java b/src/main/java/com/mycompany/autobackupprogram/BackupOperations.java index cc76361..e3d15ac 100644 --- a/src/main/java/com/mycompany/autobackupprogram/BackupOperations.java +++ b/src/main/java/com/mycompany/autobackupprogram/BackupOperations.java @@ -29,6 +29,8 @@ public class BackupOperations{ private static Thread zipThread; public static void SingleBackup(Backup backup, TrayIcon trayIcon, BackupProgressGUI progressBar) { + if (backup == null) throw new IllegalArgumentException("Backup cannot be null!"); + Logger.logMessage("Event --> automatic single backup started", Logger.LogLevel.INFO); String temp = "\\"; @@ -58,6 +60,10 @@ public static void SingleBackup(Backup backup, TrayIcon trayIcon, BackupProgress } private static void updateAfterBackup(String path1, String path2, Backup backup, TrayIcon trayIcon) { + if (backup == null) throw new IllegalArgumentException("Backup cannot be null!"); + if (path1 == null) throw new IllegalArgumentException("Initial path cannot be null!"); + if (path2 == null) throw new IllegalArgumentException("Destination path cannot be null!"); + LocalDateTime dateNow = LocalDateTime.now(); Logger.logMessage("Backup completed!", Logger.LogLevel.INFO); diff --git a/src/main/java/com/mycompany/autobackupprogram/FileCopyListener.java b/src/main/java/com/mycompany/autobackupprogram/FileCopyListener.java deleted file mode 100644 index 435f01c..0000000 --- a/src/main/java/com/mycompany/autobackupprogram/FileCopyListener.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.mycompany.autobackupprogram; - -public interface FileCopyListener { - void onFileCopied(int progress); -} \ No newline at end of file diff --git a/src/main/java/com/mycompany/autobackupprogram/TimePicker.java b/src/main/java/com/mycompany/autobackupprogram/TimePicker.java index 607ce55..097f1f6 100644 --- a/src/main/java/com/mycompany/autobackupprogram/TimePicker.java +++ b/src/main/java/com/mycompany/autobackupprogram/TimePicker.java @@ -71,6 +71,17 @@ private boolean checkInputCorrectness() { Integer minutes = (Integer) minutesSpinner.getValue(); return (days != null && days >= 0 && hours != null && hours >= 0 && hours <= 23 && minutes != null && minutes >= 0 && minutes <= 59 && (days != 0 || hours != 0 || minutes != 0)); } + + private void mouseWeel(java.awt.event.MouseWheelEvent evt) { + javax.swing.JSpinner spinner = (javax.swing.JSpinner) evt.getSource(); + int rotation = evt.getWheelRotation(); + + if (rotation < 0) { + spinner.setValue((Integer) spinner.getValue() + 1); + } else { + spinner.setValue((Integer) spinner.getValue() - 1); + } + } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -229,17 +240,6 @@ private void hoursSpinnerMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {// private void minutesSpinnerMouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_minutesSpinnerMouseWheelMoved mouseWeel(evt); }//GEN-LAST:event_minutesSpinnerMouseWheelMoved - - private void mouseWeel(java.awt.event.MouseWheelEvent evt) { - javax.swing.JSpinner spinner = (javax.swing.JSpinner) evt.getSource(); - int rotation = evt.getWheelRotation(); - - if (rotation < 0) { - spinner.setValue((Integer) spinner.getValue() + 1); - } else { - spinner.setValue((Integer) spinner.getValue() - 1); - } - } private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed if (checkInputCorrectness()) { diff --git a/src/main/java/com/mycompany/autobackupprogram/TreeCopyFileVisitor.java b/src/main/java/com/mycompany/autobackupprogram/TreeCopyFileVisitor.java deleted file mode 100644 index e80cacc..0000000 --- a/src/main/java/com/mycompany/autobackupprogram/TreeCopyFileVisitor.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.mycompany.autobackupprogram; - -import static com.mycompany.autobackupprogram.BackupManagerGUI.OpenExceptionMessage; -import java.io.IOException; -import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.Arrays; - -public class TreeCopyFileVisitor extends SimpleFileVisitor implements Runnable { - private final Path source; - private final Path target; - private boolean copied = false; - private final FileCopyListener listener; - private int copiedFilesCount; - private final int totalFilesCount; - - public TreeCopyFileVisitor(String source, String target, int totalFilesCount, FileCopyListener listener) { - this.source = Paths.get(source); - this.target = Paths.get(target); - this.listener = listener; - this.copiedFilesCount = 0; - this.totalFilesCount = totalFilesCount; - } - - @Override - public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { - Path resolve = target.resolve(source.relativize(dir)); - if (Files.notExists(resolve)) { - Files.createDirectories(resolve); - copied = true; - } - return FileVisitResult.CONTINUE; - } - - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - Path resolve = target.resolve(source.relativize(file)); - Files.copy(file, resolve, StandardCopyOption.REPLACE_EXISTING); - copiedFilesCount++; - int progress = (int) (((double) copiedFilesCount / totalFilesCount) * 100); - listener.onFileCopied(progress); - return FileVisitResult.CONTINUE; - } - - @Override - public FileVisitResult visitFileFailed(Path file, IOException exc) { - System.err.format("Error -> Unable to copy: %s: %s%n", file, exc); - copied = false; - return FileVisitResult.CONTINUE; - } - - public boolean isCopied() { - return copied; - } - - @Override - public void run() { - try { - Files.walkFileTree(source, this); - } catch (IOException ex) { - Logger.logMessage("An error occurred", Logger.LogLevel.ERROR, ex); - OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace())); - } - } -} diff --git a/src/main/resources/res/backup_list.json b/src/main/resources/res/backup_list.json index a01f7ec..cf58f2f 100644 --- a/src/main/resources/res/backup_list.json +++ b/src/main/resources/res/backup_list.json @@ -1 +1 @@ -[{"time_interval_backup":"0.0:1","destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":true,"backup_name":"test","notes":"","backup_count":40,"next_date_backup":"2024-11-06T15:29:06.859641300","start_path":"C:\\Users\\Utente\\Desktop\\AutoBackupProgram","creation_date":"2024-11-02T17:06:03.001492800","last_backup":"2024-11-06T15:28:06.859641300","last_update_date":"2024-11-04T23:06:18.579491400"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test2","notes":"","backup_count":16,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\gg","creation_date":"2024-11-04T23:04:31.346029500","last_backup":null,"last_update_date":"2024-11-05T23:14:06.283841800"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test3","notes":"","backup_count":37,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\gg","creation_date":"2024-11-04T23:04:33.154829","last_backup":"2024-11-06T15:23:06.306349900","last_update_date":"2024-11-06T15:18:15.215469900"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test4","notes":"","backup_count":16,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\fg","creation_date":"2024-11-04T23:04:35.073470600","last_backup":null,"last_update_date":"2024-11-06T00:20:26.518897900"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"prova","notes":"","backup_count":9,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\Stalcraft1.mp4","creation_date":"2024-11-05T23:00:16.706667","last_backup":"2024-11-06T14:41:11.821238200","last_update_date":"2024-11-06T14:40:52.656668400"}] \ No newline at end of file +[{"time_interval_backup":"0.0:1","destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":true,"backup_name":"test","notes":"","backup_count":41,"next_date_backup":"2024-11-06T21:15:10.867592100","start_path":"C:\\Users\\Utente\\Desktop\\AutoBackupProgram","creation_date":"2024-11-02T17:06:03.001492800","last_backup":"2024-11-06T21:14:10.867592100","last_update_date":"2024-11-04T23:06:18.579491400"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test2","notes":"","backup_count":16,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\gg","creation_date":"2024-11-04T23:04:31.346029500","last_backup":null,"last_update_date":"2024-11-05T23:14:06.283841800"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test3","notes":"","backup_count":37,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\gg","creation_date":"2024-11-04T23:04:33.154829","last_backup":"2024-11-06T15:23:06.306349900","last_update_date":"2024-11-06T15:18:15.215469900"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"test4","notes":"","backup_count":16,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\fg","creation_date":"2024-11-04T23:04:35.073470600","last_backup":null,"last_update_date":"2024-11-06T00:20:26.518897900"},{"time_interval_backup":null,"destination_path":"C:\\Users\\Utente\\Desktop","automatic_backup":false,"backup_name":"prova","notes":"","backup_count":9,"next_date_backup":null,"start_path":"C:\\Users\\Utente\\Desktop\\Stalcraft1.mp4","creation_date":"2024-11-05T23:00:16.706667","last_backup":"2024-11-06T14:41:11.821238200","last_update_date":"2024-11-06T14:40:52.656668400"}] \ No newline at end of file diff --git a/src/main/resources/res/log_file b/src/main/resources/res/log_file index c9b038d..e7a2a78 100644 --- a/src/main/resources/res/log_file +++ b/src/main/resources/res/log_file @@ -1,1078 +1,6 @@ -2024-11-06T18:38:47.094931900 [INFO] Event --> share -2024-11-06T18:38:40.705057300 [INFO] Event --> shard website -2024-11-06T18:38:03.044570100 [INFO] The application is running with administrator privileges. -2024-11-06T18:38:01.771050600 [DEBUG] Background mode: false -2024-11-06T18:38:01.742282800 [INFO] Application started -2024-11-06T18:18:33.219556700 [INFO] The application is running with administrator privileges. -2024-11-06T18:18:32.725260800 [DEBUG] Background mode: false -2024-11-06T18:18:32.707429800 [INFO] Application started -2024-11-06T18:17:45.890632100 [INFO] The application is running with administrator privileges. -2024-11-06T18:17:45.393987300 [DEBUG] Background mode: false -2024-11-06T18:17:45.377123100 [INFO] Application started -2024-11-06T18:15:45.049149500 [INFO] Event --> backup renaming -2024-11-06T18:15:28.918572900 [INFO] Event --> backup renaming -2024-11-06T18:15:12.784110100 [INFO] The application is running with administrator privileges. -2024-11-06T18:15:12.288021400 [DEBUG] Background mode: false -2024-11-06T18:15:12.270165400 [INFO] Application started -2024-11-06T18:13:04.762108500 [WARN] The folder does not exist or is invalid -2024-11-06T18:13:04.756156300 [INFO] Event --> opening folder -2024-11-06T18:12:57.105817100 [INFO] Event --> opening folder -2024-11-06T18:12:51.280874 [INFO] Event --> opening folder -2024-11-06T18:12:01.705521200 [INFO] You selected the directory: C:\Users\Utente\Desktop\gg -2024-11-06T18:11:57.123456400 [INFO] You selected the file: C:\Users\Utente\Desktop\Aseprite.url -2024-11-06T18:10:45.576643500 [INFO] The application is running with administrator privileges. -2024-11-06T18:10:45.034874200 [DEBUG] Background mode: false -2024-11-06T18:10:45.017415300 [INFO] Application started -2024-11-06T15:31:37.256730900 [INFO] The application is running with administrator privileges. -2024-11-06T15:31:36.781522200 [DEBUG] Background mode: false -2024-11-06T15:31:36.763666500 [INFO] Application started -2024-11-06T15:31:04.946853600 [INFO] The application is running with administrator privileges. -2024-11-06T15:31:04.476996600 [DEBUG] Background mode: false -2024-11-06T15:31:04.459608900 [INFO] Application started -2024-11-06T15:30:35.254673200 [INFO] The application is running with administrator privileges. -2024-11-06T15:30:34.756203200 [DEBUG] Background mode: false -2024-11-06T15:30:34.738346300 [INFO] Application started -2024-11-06T15:28:20.626626200 [INFO] Background service stopped -2024-11-06T15:28:20.619681800 [DEBUG] Stopping background service -2024-11-06T15:28:06.859145300 [INFO] Progress: 100 -2024-11-06T15:28:00.543164 [INFO] Progress: 75 -2024-11-06T15:28:00.535698600 [INFO] Progress: 75 -2024-11-06T15:27:58.519159500 [INFO] Progress: 50 -2024-11-06T15:27:58.512199100 [INFO] Progress: 50 -2024-11-06T15:27:58.342752400 [INFO] Progress: 25 -2024-11-06T15:27:58.334816500 [INFO] Progress: 25 -2024-11-06T15:27:58.182198700 [INFO] Progress: 0 -2024-11-06T15:27:58.162330700 [INFO] date backup: 06-11-2024 15.27.58 -2024-11-06T15:27:58.156378800 [INFO] Event --> automatic single backup started -2024-11-06T15:27:58.150427400 [INFO] Start backup process. -2024-11-06T15:27:58.141950800 [INFO] Checking for automatic backup... -2024-11-06T15:26:58.150122400 [INFO] No backup needed at this time. -2024-11-06T15:26:58.143150900 [INFO] Checking for automatic backup... -2024-11-06T15:26:06.848469500 [INFO] Progress: 100 -2024-11-06T15:26:00.538726600 [INFO] Progress: 75 -2024-11-06T15:26:00.531301900 [INFO] Progress: 75 -2024-11-06T15:25:58.515472100 [INFO] Progress: 50 -2024-11-06T15:25:58.505818800 [INFO] Progress: 50 -2024-11-06T15:25:58.339150500 [INFO] Progress: 25 -2024-11-06T15:25:58.331213200 [INFO] Progress: 25 -2024-11-06T15:25:58.183488200 [INFO] Progress: 0 -2024-11-06T15:25:58.164670100 [INFO] date backup: 06-11-2024 15.25.58 -2024-11-06T15:25:58.157694400 [INFO] Event --> automatic single backup started -2024-11-06T15:25:58.152196900 [INFO] Start backup process. -2024-11-06T15:25:58.144220800 [INFO] Checking for automatic backup... -2024-11-06T15:24:58.147074900 [INFO] No backup needed at this time. -2024-11-06T15:24:58.137623100 [INFO] Checking for automatic backup... -2024-11-06T15:24:06.785230400 [INFO] Progress: 100 -2024-11-06T15:24:00.571892500 [INFO] Progress: 75 -2024-11-06T15:24:00.563956500 [INFO] Progress: 75 -2024-11-06T15:23:58.556714100 [INFO] Progress: 50 -2024-11-06T15:23:58.549152100 [INFO] Progress: 50 -2024-11-06T15:23:58.372486700 [INFO] Progress: 25 -2024-11-06T15:23:58.365022300 [INFO] Progress: 25 -2024-11-06T15:23:58.203664 [INFO] Progress: 0 -2024-11-06T15:23:58.178415600 [INFO] date backup: 06-11-2024 15.23.58 -2024-11-06T15:23:58.160070600 [INFO] Event --> automatic single backup started -2024-11-06T15:23:58.150404500 [INFO] Start backup process. -2024-11-06T15:23:58.136828300 [INFO] Checking for automatic backup... -2024-11-06T15:23:58.128370700 [INFO] Time interval set to 1 minutes -2024-11-06T15:23:58.119938600 [INFO] TrayIcon added -2024-11-06T15:23:57.885936600 [INFO] Backup service starting in the background -2024-11-06T15:23:57.878000500 [DEBUG] Background mode: true -2024-11-06T15:23:57.861136300 [INFO] Application started -2024-11-06T15:23:06.316767100 [DEBUG] updating backup list -2024-11-06T15:23:06.261409900 [INFO] Progress: 100 -2024-11-06T15:23:06.147864600 [INFO] date backup: 06-11-2024 15.23.06 -2024-11-06T15:23:06.138413600 [INFO] Event --> automatic single backup started -2024-11-06T15:23:02.594976200 [INFO] The application is running with administrator privileges. -2024-11-06T15:23:02.091752900 [DEBUG] Background mode: false -2024-11-06T15:23:02.074426800 [INFO] Application started -2024-11-06T15:22:16.043186300 [DEBUG] updating backup list -2024-11-06T15:22:15.988742 [INFO] Progress: 100 -2024-11-06T15:22:15.875188900 [INFO] date backup: 06-11-2024 15.22.15 -2024-11-06T15:22:15.866725400 [INFO] Event --> automatic single backup started -2024-11-06T15:22:12.118469400 [INFO] The application is running with administrator privileges. -2024-11-06T15:22:11.610464400 [DEBUG] Background mode: false -2024-11-06T15:22:11.590089 [INFO] Application started -2024-11-06T15:19:27.441809600 [INFO] The application is running with administrator privileges. -2024-11-06T15:19:26.941663200 [DEBUG] Background mode: false -2024-11-06T15:19:26.923833900 [INFO] Application started -2024-11-06T15:18:16.098916200 [DEBUG] updating backup list -2024-11-06T15:18:16.079814900 [INFO] Progress: 100 -2024-11-06T15:18:15.934144800 [INFO] date backup: 06-11-2024 15.18.15 -2024-11-06T15:18:15.925742200 [INFO] Event --> single backup -2024-11-06T15:18:15.223354800 [DEBUG] updating backup list -2024-11-06T15:18:15.214959400 [INFO] Event --> auto backup disabled -2024-11-06T15:18:15.207522800 [INFO] Event --> opening backup -2024-11-06T15:18:15.201047700 [INFO] Edit row : 2 -2024-11-06T15:18:13.051612900 [INFO] The application is running with administrator privileges. -2024-11-06T15:18:12.552647200 [DEBUG] Background mode: false -2024-11-06T15:18:12.534813800 [INFO] Application started -2024-11-06T15:15:29.446325300 [DEBUG] updating backup list -2024-11-06T15:15:29.396084700 [INFO] Progress: 100 -2024-11-06T15:15:29.281481500 [INFO] date backup: 06-11-2024 15.15.29 -2024-11-06T15:15:29.272554300 [INFO] Event --> automatic single backup started -2024-11-06T15:15:25.187856900 [INFO] The application is running with administrator privileges. -2024-11-06T15:15:24.684241900 [DEBUG] Background mode: false -2024-11-06T15:15:24.667377300 [INFO] Application started -2024-11-06T15:12:04.705393100 [DEBUG] updating backup list -2024-11-06T15:12:03.708636400 [INFO] Progress: 100 -2024-11-06T15:12:01.615997700 [INFO] date backup: 06-11-2024 15.12.01 -2024-11-06T15:12:01.609549600 [INFO] Event --> single backup -2024-11-06T15:12:00.718038500 [INFO] You selected the file: C:\Users\Utente\Desktop\Biglietti.pdf -2024-11-06T15:11:32.023129300 [DEBUG] updating backup list -2024-11-06T15:11:31.997746400 [INFO] Progress: 100 -2024-11-06T15:11:31.880775500 [INFO] date backup: 06-11-2024 15.11.31 -2024-11-06T15:11:31.874791600 [INFO] Event --> single backup -2024-11-06T15:11:30.879323 [INFO] You selected the directory: C:\Users\Utente\Desktop -2024-11-06T15:11:28.703777200 [INFO] You selected the directory: C:\Users\Utente\Desktop\gg -2024-11-06T15:11:23.573760400 [DEBUG] updating backup list -2024-11-06T15:11:23.567342900 [INFO] Event --> auto backup disabled -2024-11-06T15:11:23.561893600 [INFO] Event --> clear -2024-11-06T15:11:23.555905200 [INFO] Event --> new backup -2024-11-06T15:09:39.978489600 [DEBUG] updating backup list -2024-11-06T15:09:39.955176800 [INFO] Progress: 100 -2024-11-06T15:09:39.829878400 [INFO] date backup: 06-11-2024 15.09.39 -2024-11-06T15:09:39.822032900 [INFO] Event --> single backup -2024-11-06T15:09:38.220093300 [DEBUG] updating backup list -2024-11-06T15:09:38.214112900 [INFO] Event --> auto backup disabled -2024-11-06T15:09:38.207614100 [INFO] Event --> opening backup -2024-11-06T15:09:38.201138200 [INFO] Edit row : 2 -2024-11-06T15:07:21.267868200 [DEBUG] updating backup list -2024-11-06T15:07:21.212646500 [INFO] Progress: 100 -2024-11-06T15:07:21.099155500 [INFO] date backup: 06-11-2024 15.07.21 -2024-11-06T15:07:21.090723500 [INFO] Event --> automatic single backup started -2024-11-06T15:07:17.071903600 [INFO] The application is running with administrator privileges. -2024-11-06T15:07:16.561507800 [DEBUG] Background mode: false -2024-11-06T15:07:16.544119 [INFO] Application started -2024-11-06T15:06:48.094051900 [INFO] The application is running with administrator privileges. -2024-11-06T15:06:47.592415300 [DEBUG] Background mode: false -2024-11-06T15:06:47.575055200 [INFO] Application started -2024-11-06T15:04:54.883192200 [DEBUG] updating backup list -2024-11-06T15:04:54.766557400 [INFO] date backup: 06-11-2024 15.04.54 -2024-11-06T15:04:54.758596900 [INFO] Event --> automatic single backup started -2024-11-06T15:04:51.430517300 [INFO] The application is running with administrator privileges. -2024-11-06T15:04:50.937347900 [DEBUG] Background mode: false -2024-11-06T15:04:50.918003300 [INFO] Application started -2024-11-06T15:03:25.056309400 [DEBUG] updating backup list -2024-11-06T15:03:16.447630800 [INFO] date backup: 06-11-2024 15.03.16 -2024-11-06T15:03:16.441175500 [INFO] Event --> automatic single backup started -2024-11-06T15:03:06.614322700 [DEBUG] updating backup list -2024-11-06T15:03:06.496275100 [INFO] date backup: 06-11-2024 15.03.06 -2024-11-06T15:03:06.487346500 [INFO] Event --> automatic single backup started -2024-11-06T15:03:02.607079 [INFO] The application is running with administrator privileges. -2024-11-06T15:03:02.110039600 [DEBUG] Background mode: false -2024-11-06T15:03:02.092648500 [INFO] Application started -2024-11-06T15:02:05.357763400 [DEBUG] updating backup list -2024-11-06T15:02:05.242403700 [INFO] date backup: 06-11-2024 15.02.05 -2024-11-06T15:02:05.234433100 [INFO] Event --> automatic single backup started -2024-11-06T15:01:58.996123500 [INFO] The application is running with administrator privileges. -2024-11-06T15:01:58.491764300 [DEBUG] Background mode: false -2024-11-06T15:01:58.474896800 [INFO] Application started -2024-11-06T15:01:03.492376400 [DEBUG] updating backup list -2024-11-06T15:00:54.999922900 [INFO] date backup: 06-11-2024 15.00.54 -2024-11-06T15:00:54.992811500 [INFO] Event --> automatic single backup started -2024-11-06T15:00:49.499317400 [DEBUG] updating backup list -2024-11-06T15:00:49.397223600 [INFO] date backup: 06-11-2024 15.00.49 -2024-11-06T15:00:49.391301700 [INFO] Event --> automatic single backup started -2024-11-06T15:00:42.286344800 [DEBUG] updating backup list -2024-11-06T15:00:42.183663300 [INFO] date backup: 06-11-2024 15.00.42 -2024-11-06T15:00:42.177711400 [INFO] Event --> automatic single backup started -2024-11-06T15:00:30.202446800 [DEBUG] updating backup list -2024-11-06T15:00:30.042386100 [INFO] date backup: 06-11-2024 15.00.30 -2024-11-06T15:00:30.035938300 [INFO] Event --> single backup -2024-11-06T15:00:25.563275100 [DEBUG] updating backup list -2024-11-06T15:00:25.556816400 [INFO] Event --> auto backup disabled -2024-11-06T15:00:25.550397800 [INFO] Event --> opening backup -2024-11-06T15:00:25.543949700 [INFO] Edit row : 2 -2024-11-06T14:59:58.461456700 [DEBUG] updating backup list -2024-11-06T14:59:58.350839700 [INFO] date backup: 06-11-2024 14.59.58 -2024-11-06T14:59:58.344893500 [INFO] Event --> automatic single backup started -2024-11-06T14:59:48.858396700 [DEBUG] updating backup list -2024-11-06T14:59:48.743827500 [INFO] date backup: 06-11-2024 14.59.48 -2024-11-06T14:59:48.735799100 [INFO] Event --> automatic single backup started -2024-11-06T14:59:41.009982700 [INFO] The application is running with administrator privileges. -2024-11-06T14:59:40.515933500 [DEBUG] Background mode: false -2024-11-06T14:59:40.499565500 [INFO] Application started -2024-11-06T14:52:23.897483 [DEBUG] updating backup list -2024-11-06T14:52:23.758364800 [INFO] date backup: 06-11-2024 14.52.23 -2024-11-06T14:52:23.751893200 [INFO] Event --> single backup -2024-11-06T14:52:22.879621900 [DEBUG] updating backup list -2024-11-06T14:52:22.872706500 [INFO] Event --> auto backup disabled -2024-11-06T14:52:22.866229400 [INFO] Event --> opening backup -2024-11-06T14:52:22.858789200 [INFO] Edit row : 2 -2024-11-06T14:52:07.440588100 [DEBUG] updating backup list -2024-11-06T14:52:07.243726200 [INFO] date backup: 06-11-2024 14.52.07 -2024-11-06T14:52:07.234302200 [INFO] Event --> single backup -2024-11-06T14:52:01.820853300 [INFO] The application is running with administrator privileges. -2024-11-06T14:52:01.317257500 [DEBUG] Background mode: false -2024-11-06T14:52:01.297913200 [INFO] Application started -2024-11-06T14:49:33.522193 [INFO] The application is running with administrator privileges. -2024-11-06T14:49:33.021337900 [DEBUG] Background mode: false -2024-11-06T14:49:33.003847900 [INFO] Application started -2024-11-06T14:49:21.720939700 [INFO] The application is running with administrator privileges. -2024-11-06T14:49:21.228051800 [DEBUG] Background mode: false -2024-11-06T14:49:21.211426100 [INFO] Application started -2024-11-06T14:47:56.498516500 [DEBUG] updating backup list -2024-11-06T14:47:56.299164100 [INFO] date backup: 06-11-2024 14.47.56 -2024-11-06T14:47:56.290704200 [INFO] Event --> single backup -2024-11-06T14:47:52.138226900 [INFO] The application is running with administrator privileges. -2024-11-06T14:47:51.615623500 [DEBUG] Background mode: false -2024-11-06T14:47:51.598262700 [INFO] Application started -2024-11-06T14:47:02.121589200 [DEBUG] updating backup list -2024-11-06T14:47:01.905474600 [INFO] date backup: 06-11-2024 14.47.01 -2024-11-06T14:47:01.896546500 [INFO] Event --> single backup -2024-11-06T14:46:51.639269900 [INFO] The application is running with administrator privileges. -2024-11-06T14:46:51.120924 [DEBUG] Background mode: false -2024-11-06T14:46:51.104059500 [INFO] Application started -2024-11-06T14:45:42.639108 [INFO] The application is running with administrator privileges. -2024-11-06T14:45:42.138903900 [DEBUG] Background mode: false -2024-11-06T14:45:42.121548800 [INFO] Application started -2024-11-06T14:41:11.801661 [INFO] date backup: 06-11-2024 14.41.11 -2024-11-06T14:41:11.795213900 [INFO] Event --> single backup -2024-11-06T14:40:53.697811600 [INFO] date backup: 06-11-2024 14.40.53 -2024-11-06T14:40:53.689848500 [INFO] Event --> single backup -2024-11-06T14:40:52.656172400 [INFO] Event --> auto backup disabled -2024-11-06T14:40:52.649228300 [INFO] Event --> opening backup -2024-11-06T14:40:52.643276200 [INFO] Edit row : 4 -2024-11-06T14:40:51.128926200 [INFO] Event --> opening backup -2024-11-06T14:40:51.122478100 [INFO] Edit row : 0 -2024-11-06T14:40:49.162162300 [INFO] The application is running with administrator privileges. -2024-11-06T14:40:48.656040 [DEBUG] Background mode: false -2024-11-06T14:40:48.639180400 [INFO] Application started -2024-11-06T14:39:28.562735 [INFO] date backup: 06-11-2024 14.39.28 -2024-11-06T14:39:28.556080400 [INFO] Event --> single backup -2024-11-06T14:39:24.878552 [INFO] Event --> auto backup disabled -2024-11-06T14:39:24.872599600 [INFO] Event --> opening backup -2024-11-06T14:39:24.866647600 [INFO] Edit row : 4 -2024-11-06T14:39:02.091520900 [INFO] date backup: 06-11-2024 14.39.02 -2024-11-06T14:39:02.085059200 [INFO] Event --> single backup -2024-11-06T14:38:09.470085300 [INFO] date backup: 06-11-2024 14.38.09 -2024-11-06T14:38:09.461859200 [INFO] Event --> single backup -2024-11-06T14:38:08.508722400 [INFO] Event --> opening backup -2024-11-06T14:38:08.501282300 [INFO] Edit row : 0 -2024-11-06T14:38:05.641096300 [INFO] The application is running with administrator privileges. -2024-11-06T14:38:05.127290700 [DEBUG] Background mode: false -2024-11-06T14:38:05.108442400 [INFO] Application started -2024-11-06T14:28:45.891155700 [INFO] date backup: 06-11-2024 14.28.45 -2024-11-06T14:28:45.882695500 [INFO] Event --> single backup -2024-11-06T14:28:40.466376700 [INFO] The application is running with administrator privileges. -2024-11-06T14:28:39.965559200 [DEBUG] Background mode: false -2024-11-06T14:28:39.948199400 [INFO] Application started -2024-11-06T14:06:58.028454300 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T14:02:30.968619800, IsAutoBackup: true, NextDate: 2024-11-06T14:03:30.968619800, Interval: 0.0:1] -2024-11-06T14:06:58.022529900 [INFO] Event --> automatic single backup started -2024-11-06T14:06:58.015062400 [INFO] Zipping process completed successfully! -2024-11-06T14:06:54.862091 [INFO] Background service stopped -2024-11-06T14:06:54.854650500 [DEBUG] Stopping background service -2024-11-06T14:06:49.419567100 [INFO] Start backup process. -2024-11-06T14:06:49.412623100 [INFO] Checking for automatic backup... -2024-11-06T14:06:49.407203500 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T14:02:30.968619800, IsAutoBackup: true, NextDate: 2024-11-06T14:03:30.968619800, Interval: 0.0:1] -2024-11-06T14:06:49.400718900 [INFO] Start backup process. -2024-11-06T14:06:49.394299 [INFO] Event --> automatic single backup started -2024-11-06T14:06:49.388319 [INFO] Checking for automatic backup... -2024-11-06T14:06:49.381871200 [INFO] Start backup process. -2024-11-06T14:04:22.202897600 [INFO] Checking for automatic backup... -2024-11-06T14:03:44.013987100 [INFO] The application is running with administrator privileges. -2024-11-06T14:03:43.506028 [DEBUG] Background mode: false -2024-11-06T14:03:43.489152200 [INFO] Application started -2024-11-06T14:03:22.215491800 [INFO] No backup needed at this time. -2024-11-06T14:03:22.208540600 [INFO] Checking for automatic backup... -2024-11-06T14:02:30.968095 [INFO] Zipping process completed successfully! -2024-11-06T14:02:22.255251300 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:58:11.956209400, IsAutoBackup: true, NextDate: 2024-11-06T13:59:11.956209400, Interval: 0.0:1] -2024-11-06T14:02:22.228858300 [INFO] Event --> automatic single backup started -2024-11-06T14:02:22.220922500 [INFO] Start backup process. -2024-11-06T14:02:22.207034100 [INFO] Checking for automatic backup... -2024-11-06T14:02:22.198601500 [INFO] Time interval set to 1 minutes -2024-11-06T14:02:22.190169500 [INFO] TrayIcon added -2024-11-06T14:02:21.958651200 [INFO] Backup service starting in the background -2024-11-06T14:02:21.951707200 [DEBUG] Background mode: true -2024-11-06T14:02:21.936514300 [INFO] Application started -2024-11-06T13:58:56.799251100 [INFO] Background service stopped -2024-11-06T13:58:56.792306900 [DEBUG] Stopping background service -2024-11-06T13:58:11.955217900 [INFO] Zipping process completed successfully! -2024-11-06T13:58:02.825669200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:56:08.180165400, IsAutoBackup: true, NextDate: 2024-11-06T13:57:08.180165400, Interval: 0.0:1] -2024-11-06T13:58:02.795032800 [INFO] Event --> automatic single backup started -2024-11-06T13:58:02.770398600 [INFO] Start backup process. -2024-11-06T13:58:02.762927800 [INFO] Checking for automatic backup... -2024-11-06T13:57:02.769103200 [INFO] No backup needed at this time. -2024-11-06T13:57:02.756207500 [INFO] Checking for automatic backup... -2024-11-06T13:57:02.746289200 [INFO] Time interval set to 1 minutes -2024-11-06T13:57:02.736367100 [INFO] TrayIcon added -2024-11-06T13:57:02.503130800 [INFO] Backup service starting in the background -2024-11-06T13:57:02.496150500 [DEBUG] Background mode: true -2024-11-06T13:57:02.480774200 [INFO] Application started -2024-11-06T13:55:59.456526100 [INFO] date backup: 06-11-2024 13.55.59 -2024-11-06T13:55:59.450068800 [INFO] Event --> single backup -2024-11-06T13:55:35.046233200 [INFO] date backup: 06-11-2024 13.55.35 -2024-11-06T13:55:35.037801800 [INFO] Event --> single backup -2024-11-06T13:55:33.859251800 [INFO] Event --> opening backup -2024-11-06T13:55:33.853298 [INFO] Edit row : 0 -2024-11-06T13:55:27.577696100 [INFO] The application is running with administrator privileges. -2024-11-06T13:55:27.099229600 [DEBUG] Background mode: false -2024-11-06T13:55:27.082365800 [INFO] Application started -2024-11-06T13:46:18.388647100 [INFO] The application is running with administrator privileges. -2024-11-06T13:46:17.884665400 [DEBUG] Background mode: false -2024-11-06T13:46:17.867798500 [INFO] Application started -2024-11-06T13:45:29.461823 [INFO] Zipping process completed successfully! -2024-11-06T13:45:23.600562500 [INFO] Background service stopped -2024-11-06T13:45:23.594610600 [DEBUG] Stopping background service -2024-11-06T13:45:20.849369500 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:42:25.609785500, IsAutoBackup: true, NextDate: 2024-11-06T13:43:25.609785500, Interval: 0.0:1] -2024-11-06T13:45:20.842425400 [INFO] Event --> automatic single backup started -2024-11-06T13:45:20.834984900 [INFO] Start backup process. -2024-11-06T13:44:49.576326900 [INFO] Checking for automatic backup... -2024-11-06T13:43:58.209421600 [INFO] Zipping process completed successfully! -2024-11-06T13:43:49.622255800 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:42:25.609785500, IsAutoBackup: true, NextDate: 2024-11-06T13:43:25.609785500, Interval: 0.0:1] -2024-11-06T13:43:49.596114600 [INFO] Event --> automatic single backup started -2024-11-06T13:43:49.587162600 [INFO] Start backup process. -2024-11-06T13:43:49.579253600 [INFO] Checking for automatic backup... -2024-11-06T13:42:49.583457800 [INFO] No backup needed at this time. -2024-11-06T13:42:49.571554100 [INFO] Checking for automatic backup... -2024-11-06T13:42:49.562129800 [INFO] Time interval set to 1 minutes -2024-11-06T13:42:49.552210900 [INFO] TrayIcon added -2024-11-06T13:42:49.324546400 [INFO] Backup service starting in the background -2024-11-06T13:42:49.316113700 [DEBUG] Background mode: true -2024-11-06T13:42:49.301233900 [INFO] Application started -2024-11-06T13:42:25.641033200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.634585500 [INFO] date backup: 06-11-2024 13.42.25 -2024-11-06T13:42:25.625657300 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:25.609289200 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.603337300 [INFO] Zipping process completed successfully! -2024-11-06T13:42:25.550265200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.543817300 [INFO] date backup: 06-11-2024 13.42.25 -2024-11-06T13:42:25.537865300 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:25.521497300 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.515049300 [INFO] Zipping process completed successfully! -2024-11-06T13:42:25.493225200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.487273300 [INFO] date backup: 06-11-2024 13.42.25 -2024-11-06T13:42:25.480825200 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:25.464953300 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.459001200 [INFO] Zipping process completed successfully! -2024-11-06T13:42:25.439161200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.432713200 [INFO] date backup: 06-11-2024 13.42.25 -2024-11-06T13:42:25.426761200 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:25.410393100 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.403449200 [INFO] Zipping process completed successfully! -2024-11-06T13:42:25.369225100 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.363273100 [INFO] date backup: 06-11-2024 13.42.25 -2024-11-06T13:42:25.357321200 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:25.332025500 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:25.326569300 [INFO] Zipping process completed successfully! -2024-11-06T13:42:22.998840300 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:22.951224400 [INFO] date backup: 06-11-2024 13.42.22 -2024-11-06T13:42:22.815816200 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:22.699256300 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:22.677432300 [INFO] Zipping process completed successfully! -2024-11-06T13:42:22.449272200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:22.443320300 [INFO] date backup: 06-11-2024 13.42.22 -2024-11-06T13:42:22.338168300 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:22.310392100 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:22.214664 [INFO] Zipping process completed successfully! -2024-11-06T13:42:22.094136 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:22.088184400 [INFO] date backup: 06-11-2024 13.42.22 -2024-11-06T13:42:22.056936 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.980055900 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.962200 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.912600 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.904168 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.890776 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.873912200 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.837208 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.820840100 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.814392300 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.804968100 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.776695900 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.768760200 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.759832200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.753384400 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.746936100 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.722135900 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.713704200 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.705271900 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.699320100 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.691383900 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.665096200 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.659144 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.652200500 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.645752200 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.639303900 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.612520100 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.606072 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.599624200 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.593671900 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.587224200 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.559447800 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.553496 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.545560100 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.538616300 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.531176400 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.500919800 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.493975900 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.486535800 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.480088 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.473639800 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.460744200 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.454819800 [INFO] Zipping process completed successfully! -2024-11-06T13:42:21.448840300 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:19:27.736083600, IsAutoBackup: true, NextDate: 2024-11-06T13:20:27.736083600, Interval: 0.0:1] -2024-11-06T13:42:21.441895800 [INFO] date backup: 06-11-2024 13.42.21 -2024-11-06T13:42:21.435944600 [INFO] Event --> automatic single backup automatic -2024-11-06T13:42:21.427016600 [INFO] Showing the GUI -2024-11-06T13:42:21.416128200 [INFO] Showing the GUI -2024-11-06T13:42:21.408087 [INFO] Showing the GUI -2024-11-06T13:42:21.401142800 [INFO] Showing the GUI -2024-11-06T13:42:09.717169600 [INFO] The application is running with administrator privileges. -2024-11-06T13:42:09.672530 [INFO] Start backup process. -2024-11-06T13:42:09.662112700 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.654177200 [INFO] Start backup process. -2024-11-06T13:42:09.646736800 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.638305100 [INFO] Start backup process. -2024-11-06T13:42:09.630368900 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.622432700 [INFO] Start backup process. -2024-11-06T13:42:09.613505200 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.606560800 [INFO] Start backup process. -2024-11-06T13:42:09.599120900 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.592673600 [INFO] Start backup process. -2024-11-06T13:42:09.586224900 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.578784700 [INFO] Start backup process. -2024-11-06T13:42:09.571840900 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.565392300 [INFO] Start backup process. -2024-11-06T13:42:09.558449100 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.551008800 [INFO] Start backup process. -2024-11-06T13:42:09.544065 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.537616500 [INFO] Start backup process. -2024-11-06T13:42:09.530176800 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.523232800 [INFO] Start backup process. -2024-11-06T13:42:09.515793 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.509840600 [INFO] Start backup process. -2024-11-06T13:42:09.495952400 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.488017 [INFO] Start backup process. -2024-11-06T13:42:09.481072600 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.474624800 [INFO] Start backup process. -2024-11-06T13:42:09.466688400 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.459745 [INFO] Start backup process. -2024-11-06T13:42:09.452800500 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.442384400 [INFO] Start backup process. -2024-11-06T13:42:09.421552600 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.413120500 [INFO] Start backup process. -2024-11-06T13:42:09.399728700 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.387825100 [INFO] Start backup process. -2024-11-06T13:42:09.377409400 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.369968200 [INFO] Start backup process. -2024-11-06T13:42:09.358064600 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.349136800 [INFO] Start backup process. -2024-11-06T13:42:09.338224600 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.330319200 [INFO] Start backup process. -2024-11-06T13:42:09.322848600 [INFO] Checking for automatic backup... -2024-11-06T13:42:09.315436700 [INFO] Start backup process. -2024-11-06T13:42:09.305984600 [INFO] Showing the GUI -2024-11-06T13:35:54.021282600 [INFO] The application is running with administrator privileges. -2024-11-06T13:35:53.508945300 [DEBUG] Background mode: false -2024-11-06T13:35:53.492602200 [INFO] Application started -2024-11-06T13:21:17.157684500 [INFO] Event --> auto backup disabled -2024-11-06T13:20:42.734771300 [INFO] The application is running with administrator privileges. -2024-11-06T13:20:42.233046500 [DEBUG] Background mode: false -2024-11-06T13:20:42.217167 [INFO] Application started -2024-11-06T13:20:27.664607 [INFO] Checking for automatic backup... -2024-11-06T13:19:27.774771600 [DEBUG] Completed backup for: [Name: prova, InitialPath: C:\Users\Utente\Desktop\Stalcraft1.mp4, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:16:09.326964700, IsAutoBackup: true, NextDate: 2024-11-06T13:17:09.326964700, Interval: 0.0:1] -2024-11-06T13:19:27.768323700 [INFO] Zipping process completed successfully! -2024-11-06T13:19:27.761875700 [DEBUG] Starting backup for: [Name: prova, InitialPath: C:\Users\Utente\Desktop\Stalcraft1.mp4, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:16:09.326964700, IsAutoBackup: true, NextDate: 2024-11-06T13:17:09.326964700, Interval: 0.0:1] -2024-11-06T13:19:27.755923800 [INFO] date backup: 06-11-2024 13.19.27 -2024-11-06T13:19:27.749972100 [INFO] Event --> automatic single backup automatic -2024-11-06T13:19:27.735587600 [DEBUG] Completed backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:16:09.294228, IsAutoBackup: true, NextDate: 2024-11-06T13:17:09.294228, Interval: 0.0:1] -2024-11-06T13:19:27.729635800 [INFO] Zipping process completed successfully! -2024-11-06T13:19:27.721268 [DEBUG] Starting backup for: [Name: test, InitialPath: C:\Users\Utente\Desktop\AutoBackupProgram, DestinationPath: C:\Users\Utente\Desktop, LastBackup: 2024-11-06T13:16:09.294228, IsAutoBackup: true, NextDate: 2024-11-06T13:17:09.294228, Interval: 0.0:1] -2024-11-06T13:19:27.707380100 [INFO] date backup: 06-11-2024 13.19.27 -2024-11-06T13:19:27.688532800 [INFO] Event --> automatic single backup automatic -2024-11-06T13:19:27.679563600 [INFO] Start backup process. -2024-11-06T13:19:27.667859100 [INFO] Checking for automatic backup... -2024-11-06T13:19:27.659426900 [INFO] Time interval set to 1 minutes -2024-11-06T13:19:27.650994900 [INFO] TrayIcon added -2024-11-06T13:19:27.416654 [INFO] Backup service starting in the background -2024-11-06T13:19:27.409214500 [DEBUG] Background mode: true -2024-11-06T13:19:27.395326100 [INFO] Application started -2024-11-06T13:16:09.326468800 [INFO] Zipping process completed successfully! -2024-11-06T13:16:09.318532500 [INFO] date backup: 06-11-2024 13.16.09 -2024-11-06T13:16:09.312084600 [INFO] Event --> automatic single backup automatic -2024-11-06T13:16:09.293732400 [INFO] Zipping process completed successfully! -2024-11-06T13:16:09.284804400 [INFO] date backup: 06-11-2024 13.16.09 -2024-11-06T13:16:09.266451800 [INFO] Event --> automatic single backup automatic -2024-11-06T13:16:09.258018500 [INFO] Start backup process. -2024-11-06T13:16:09.245708200 [INFO] Checking for automatic backup... -2024-11-06T13:16:09.236751200 [INFO] Time interval set to 1 minutes -2024-11-06T13:16:09.226832100 [INFO] TrayIcon added -2024-11-06T13:16:08.998464900 [INFO] Backup service starting in the background -2024-11-06T13:16:08.991520600 [DEBUG] Background mode: true -2024-11-06T13:16:08.977357300 [INFO] Application started -2024-11-06T13:14:56.443667300 [INFO] The application is running with administrator privileges. -2024-11-06T13:14:55.925829100 [DEBUG] Background mode: false -2024-11-06T13:14:55.909928200 [INFO] Application started -2024-11-06T12:56:31.300785600 [INFO] date backup: 06-11-2024 12.56.31 -2024-11-06T12:56:31.292825200 [INFO] Event --> single backup -2024-11-06T12:56:28.769329700 [INFO] Event --> opening backup -2024-11-06T12:56:28.763378600 [INFO] Edit row : 0 -2024-11-06T12:56:17.955244200 [INFO] Event --> opening backup -2024-11-06T12:56:17.947804 [INFO] Edit row : 0 -2024-11-06T12:56:04.348505700 [INFO] The application is running with administrator privileges. -2024-11-06T12:56:03.807988800 [DEBUG] Background mode: false -2024-11-06T12:56:03.792121100 [INFO] Application started -2024-11-06T12:53:08.571554700 [INFO] Zipping process manually interrupted -2024-11-06T12:53:00.087478700 [INFO] date backup: 06-11-2024 12.53.00 -2024-11-06T12:53:00.062651300 [INFO] Event --> single backup -2024-11-06T12:52:57.518695800 [INFO] Event --> opening backup -2024-11-06T12:52:57.512218 [INFO] Edit row : 0 -2024-11-06T12:52:51.071180400 [INFO] The application is running with administrator privileges. -2024-11-06T12:52:50.446219200 [DEBUG] Background mode: false -2024-11-06T12:52:50.430843200 [INFO] Application started -2024-11-06T00:26:02.174199100 [INFO] The application is running with administrator privileges. -2024-11-06T00:26:01.684920800 [DEBUG] Background mode: false -2024-11-06T00:26:01.669049300 [INFO] Application started -2024-11-06T00:20:35.543015900 [INFO] The application is running with administrator privileges. -2024-11-06T00:20:35.053212400 [DEBUG] Background mode: false -2024-11-06T00:20:35.037361400 [INFO] Application started -2024-11-06T00:20:30.656846400 [INFO] Event --> auto backup disabled -2024-11-06T00:20:26.517918900 [INFO] Event --> auto backup disabled -2024-11-06T00:20:23.200337300 [INFO] The application is running with administrator privileges. -2024-11-06T00:20:22.699338400 [DEBUG] Background mode: false -2024-11-06T00:20:22.683962500 [INFO] Application started -2024-11-06T00:19:03.309116100 [INFO] Event --> auto backup disabled -2024-11-06T00:18:38.400226300 [INFO] The application is running with administrator privileges. -2024-11-06T00:18:37.900945300 [DEBUG] Background mode: false -2024-11-06T00:18:37.886065400 [INFO] Application started -2024-11-06T00:15:45.783170900 [INFO] The application is running with administrator privileges. -2024-11-06T00:15:45.292100700 [DEBUG] Background mode: false -2024-11-06T00:15:45.277221300 [INFO] Application started -2024-11-06T00:15:41.061059100 [INFO] Event --> auto backup disabled -2024-11-06T00:15:24.348783 [INFO] Event --> shard website -2024-11-06T00:15:18.419572400 [INFO] Event --> share -2024-11-06T00:15:13.040363100 [INFO] Event --> bug report -2024-11-06T00:15:09.267241 [INFO] The application is running with administrator privileges. -2024-11-06T00:15:08.777597 [DEBUG] Background mode: false -2024-11-06T00:15:08.760236900 [INFO] Application started -2024-11-06T00:09:26.730406100 [INFO] The application is running with administrator privileges. -2024-11-06T00:09:26.225619100 [DEBUG] Background mode: false -2024-11-06T00:09:26.209251300 [INFO] Application started -2024-11-06T00:09:05.342976100 [INFO] date backup: 06-11-2024 00.09.05 -2024-11-06T00:09:05.335535900 [INFO] Event --> automatic single backup automatic -2024-11-06T00:09:05.308752 [WARN] Input Error! One or both paths do not exist. -2024-11-06T00:09:05.301808500 [INFO] Event --> automatic single backup automatic -2024-11-06T00:09:05.248737300 [INFO] date backup: 06-11-2024 00.09.05 -2024-11-06T00:09:05.240800600 [INFO] Event --> automatic single backup automatic -2024-11-06T00:09:05.222943700 [INFO] date backup: 06-11-2024 00.09.05 -2024-11-06T00:09:05.215608400 [INFO] Event --> automatic single backup automatic -2024-11-06T00:09:05.209161500 [INFO] Start backup process. -2024-11-06T00:09:05.200729 [INFO] Checking for automatic backup... -2024-11-06T00:08:05.215909900 [WARN] Input Error! One or both paths do not exist. -2024-11-06T00:08:05.209981800 [INFO] Event --> automatic single backup automatic -2024-11-06T00:08:05.203536 [INFO] Start backup process. -2024-11-06T00:08:05.196097300 [INFO] Checking for automatic backup... -2024-11-06T00:07:05.313200 [INFO] date backup: 06-11-2024 00.07.05 -2024-11-06T00:07:05.306255800 [INFO] Event --> automatic single backup automatic -2024-11-06T00:07:05.277487800 [WARN] Input Error! One or both paths do not exist. -2024-11-06T00:07:05.270047700 [INFO] Event --> automatic single backup automatic -2024-11-06T00:07:05.236816500 [INFO] date backup: 06-11-2024 00.07.05 -2024-11-06T00:07:05.229871900 [INFO] Event --> automatic single backup automatic -2024-11-06T00:07:05.215488500 [INFO] date backup: 06-11-2024 00.07.05 -2024-11-06T00:07:05.208573800 [INFO] Event --> automatic single backup automatic -2024-11-06T00:07:05.202619500 [INFO] Start backup process. -2024-11-06T00:07:05.195151800 [INFO] Checking for automatic backup... -2024-11-06T00:06:05.215282700 [WARN] Input Error! One or both paths do not exist. -2024-11-06T00:06:05.207865300 [INFO] Event --> automatic single backup automatic -2024-11-06T00:06:05.202124600 [INFO] Start backup process. -2024-11-06T00:06:05.193695300 [INFO] Checking for automatic backup... -2024-11-06T00:05:21.843226100 [INFO] The application is running with administrator privileges. -2024-11-06T00:05:21.340877100 [DEBUG] Background mode: false -2024-11-06T00:05:21.325005 [INFO] Application started -2024-11-06T00:05:05.341300200 [INFO] date backup: 06-11-2024 00.05.05 -2024-11-06T00:05:05.334852800 [INFO] Event --> automatic single backup automatic -2024-11-06T00:05:05.301124700 [WARN] Input Error! One or both paths do not exist. -2024-11-06T00:05:05.293188300 [INFO] Event --> automatic single backup automatic -2024-11-06T00:05:05.262932500 [INFO] date backup: 06-11-2024 00.05.05 -2024-11-06T00:05:05.254996600 [INFO] Event --> automatic single backup automatic -2024-11-06T00:05:05.241108600 [INFO] date backup: 06-11-2024 00.05.05 -2024-11-06T00:05:05.220276300 [INFO] Event --> automatic single backup automatic -2024-11-06T00:05:05.210852700 [INFO] Start backup process. -2024-11-06T00:05:05.198452100 [INFO] Checking for automatic backup... -2024-11-06T00:05:05.190516300 [INFO] Time interval set to 1 minutes -2024-11-06T00:05:05.180596800 [INFO] TrayIcon added -2024-11-06T00:05:04.946774600 [INFO] Backup service starting in the background -2024-11-06T00:05:04.939832400 [DEBUG] Background mode: true -2024-11-06T00:05:04.924951100 [INFO] Application started -2024-11-06T00:04:11.748986100 [INFO] Event --> removing backup -2024-11-06T00:04:11.100446800 [INFO] Event --> deleting backup -2024-11-06T00:04:09.084956900 [INFO] Event --> removing backup -2024-11-06T00:04:08.351317200 [INFO] Event --> deleting backup -2024-11-06T00:03:48.459729100 [INFO] The application is running with administrator privileges. -2024-11-06T00:03:47.976510400 [DEBUG] Background mode: false -2024-11-06T00:03:47.960638700 [INFO] Application started -2024-11-06T00:03:15.768195500 [INFO] Event --> duplicating backup -2024-11-06T00:03:11.297352700 [INFO] The application is running with administrator privileges. -2024-11-06T00:03:10.820144300 [DEBUG] Background mode: false -2024-11-06T00:03:10.803926300 [INFO] Application started -2024-11-06T00:01:42.650531100 [INFO] Event --> duplicating backup -2024-11-06T00:01:26.983750800 [INFO] The application is running with administrator privileges. -2024-11-06T00:01:26.490904600 [DEBUG] Background mode: false -2024-11-06T00:01:26.474536500 [INFO] Application started -2024-11-06T00:01:14.322924700 [INFO] Event --> opening backup -2024-11-06T00:01:14.316476100 [INFO] Edit row : 0 -2024-11-06T00:01:12.385634100 [INFO] Event --> opening backup -2024-11-06T00:01:12.377201700 [INFO] Edit row : 2 -2024-11-06T00:01:06.780177100 [INFO] The application is running with administrator privileges. -2024-11-06T00:01:06.292307300 [DEBUG] Background mode: false -2024-11-06T00:01:06.276407300 [INFO] Application started -2024-11-06T00:00:02.322307400 [INFO] date backup: 06-11-2024 00.00.02 -2024-11-06T00:00:02.313380200 [INFO] Event --> single backup -2024-11-06T00:00:01.355642100 [INFO] Event --> opening backup -2024-11-06T00:00:01.348698200 [INFO] Edit row : 0 -2024-11-05T23:59:58.903061800 [INFO] The application is running with administrator privileges. -2024-11-05T23:59:58.414388500 [DEBUG] Background mode: false -2024-11-05T23:59:58.399002500 [INFO] Application started -2024-11-05T23:50:46.354877 [INFO] date backup: 05-11-2024 23.50.46 -2024-11-05T23:50:46.346914900 [INFO] Event --> single backup -2024-11-05T23:50:45.412897900 [INFO] Event --> opening backup -2024-11-05T23:50:45.405925500 [INFO] Edit row : 0 -2024-11-05T23:50:43.195740100 [INFO] The application is running with administrator privileges. -2024-11-05T23:50:42.709037500 [DEBUG] Background mode: false -2024-11-05T23:50:42.694157400 [INFO] Application started -2024-11-05T23:47:42.377480 [INFO] date backup: 05-11-2024 23.47.42 -2024-11-05T23:47:42.368055800 [INFO] Event --> single backup -2024-11-05T23:47:35.617233500 [INFO] Event --> opening backup -2024-11-05T23:47:35.611281500 [INFO] Edit row : 0 -2024-11-05T23:47:31.203924 [INFO] The application is running with administrator privileges. -2024-11-05T23:47:30.713938500 [DEBUG] Background mode: false -2024-11-05T23:47:30.698066500 [INFO] Application started -2024-11-05T23:41:31.982747900 [INFO] date backup: 05-11-2024 23.41.31 -2024-11-05T23:41:31.975311600 [INFO] Event --> single backup -2024-11-05T23:41:30.725048900 [INFO] Event --> opening backup -2024-11-05T23:41:30.717608700 [INFO] Edit row : 2 -2024-11-05T23:41:22.167222 [INFO] The application is running with administrator privileges. -2024-11-05T23:41:21.669809300 [DEBUG] Background mode: false -2024-11-05T23:41:21.653965300 [INFO] Application started -2024-11-05T23:41:14.281028100 [INFO] date backup: 05-11-2024 23.41.14 -2024-11-05T23:41:14.273092300 [INFO] Event --> single backup -2024-11-05T23:41:12.686345200 [INFO] Event --> opening backup -2024-11-05T23:41:12.679401300 [INFO] Edit row : 2 -2024-11-05T23:41:09.507474500 [INFO] The application is running with administrator privileges. -2024-11-05T23:41:08.993607800 [DEBUG] Background mode: false -2024-11-05T23:41:08.976744 [INFO] Application started -2024-11-05T23:14:28.178759100 [INFO] The application is running with administrator privileges. -2024-11-05T23:14:27.695066100 [DEBUG] Background mode: false -2024-11-05T23:14:27.679195300 [INFO] Application started -2024-11-05T23:14:23.835329600 [INFO] Event --> auto backup disabled -2024-11-05T23:14:12.052739900 [INFO] The application is running with administrator privileges. -2024-11-05T23:14:11.566584400 [DEBUG] Background mode: false -2024-11-05T23:14:11.550712400 [INFO] Application started -2024-11-05T23:14:06.283374300 [INFO] Event --> auto backup disabled -2024-11-05T23:14:06.276897900 [INFO] Event --> Auto Backup setted to Disabled -2024-11-05T23:14:04.836011100 [INFO] Event --> auto backup preference -2024-11-05T23:14:00.323691400 [INFO] Event --> Auto Backup setted to Enabled -2024-11-05T23:14:00.317243600 [INFO] Event --> automatic backup -2024-11-05T23:13:59.296934400 [INFO] Event --> auto backup preference -2024-11-05T23:13:58.496362800 [INFO] Event --> saving backup -2024-11-05T23:13:52.836421100 [WARN] Input Error! One or both paths do not exist. -2024-11-05T23:13:52.829511800 [INFO] Event --> auto backup preference -2024-11-05T23:13:51.117203300 [INFO] Event --> opening backup -2024-11-05T23:13:51.109798100 [INFO] Edit row : 1 -2024-11-05T23:13:35.346380100 [INFO] The application is running with administrator privileges. -2024-11-05T23:13:34.858226100 [DEBUG] Background mode: false -2024-11-05T23:13:34.843842900 [INFO] Application started -2024-11-05T23:13:30.322056100 [INFO] Event --> auto backup disabled -2024-11-05T23:13:28.186125400 [INFO] Event --> auto backup disabled -2024-11-05T23:13:10.999273600 [INFO] The application is running with administrator privileges. -2024-11-05T23:13:10.494836100 [DEBUG] Background mode: false -2024-11-05T23:13:10.479956100 [INFO] Application started -2024-11-05T23:12:30.860613300 [INFO] date backup: 05-11-2024 23.12.30 -2024-11-05T23:12:30.853172900 [INFO] Event --> automatic single backup automatic -2024-11-05T23:12:30.823910900 [WARN] Input Error! One or both paths do not exist. -2024-11-05T23:12:30.816965 [INFO] Event --> automatic single backup automatic -2024-11-05T23:12:30.786212800 [INFO] date backup: 05-11-2024 23.12.30 -2024-11-05T23:12:30.779269 [INFO] Event --> automatic single backup automatic -2024-11-05T23:12:30.755957200 [WARN] Input Error! One or both paths do not exist. -2024-11-05T23:12:30.749013200 [INFO] Event --> automatic single backup automatic -2024-11-05T23:12:30.728677 [INFO] date backup: 05-11-2024 23.12.30 -2024-11-05T23:12:30.695858500 [INFO] Event --> automatic single backup automatic -2024-11-05T23:12:30.685938500 [INFO] Start backup process. -2024-11-05T23:12:30.675495200 [INFO] Checking for automatic backup... -2024-11-05T23:12:30.666456 [INFO] Time interval set to 1 minutes -2024-11-05T23:12:30.656011900 [INFO] TrayIcon added -2024-11-05T23:12:30.395327400 [INFO] Backup service starting in the background -2024-11-05T23:12:30.388874400 [DEBUG] Background mode: true -2024-11-05T23:12:30.374986300 [INFO] Application started -2024-11-05T23:01:11.408638900 [INFO] Event --> auto backup disabled -2024-11-05T23:01:07.910508 [INFO] Event --> auto backup disabled -2024-11-05T23:00:27.069487200 [INFO] Event --> Next date backup setted to 2024-11-05T23:01:27.068989300 -2024-11-05T23:00:23.934289600 [INFO] Event --> automatic backup -2024-11-05T23:00:16.708651100 [INFO] Backup 'prova' saved successfully! -2024-11-05T23:00:14.614264400 [INFO] Event --> save with name -2024-11-05T23:00:14.608285300 [INFO] Event --> saving backup -2024-11-05T23:00:09.265561400 [INFO] Event --> save with name -2024-11-05T23:00:09.257743200 [INFO] Event --> saving backup -2024-11-05T23:00:02.565769300 [INFO] Event --> save with name -2024-11-05T23:00:02.558797400 [INFO] Event --> saving backup -2024-11-05T22:58:42.771663900 [INFO] You selected the directory: C:\Users\Utente\Desktop -2024-11-05T22:58:14.634424200 [INFO] You selected the file: C:\Users\Utente\Desktop\Stalcraft1.mp4 -2024-11-05T22:58:02.172975100 [INFO] The application is running with administrator privileges. -2024-11-05T22:58:01.416466300 [DEBUG] Background mode: false -2024-11-05T22:58:01.401505500 [INFO] Application started -2024-11-05T19:09:11.275387800 [INFO] The application is running with administrator privileges. -2024-11-05T19:09:10.780662100 [DEBUG] Background mode: false -2024-11-05T19:09:10.764293900 [INFO] Application started -2024-11-05T19:05:10.711528400 [INFO] date backup: 05-11-2024 19.05.10 -2024-11-05T19:05:10.701579700 [INFO] Event --> single backup -2024-11-05T19:05:09.187876900 [INFO] You selected the directory: C:\Users\Utente\Desktop -2024-11-05T19:05:07.001765600 [INFO] You selected the file: C:\Users\Utente\Desktop\Stalcraft1.mp4 -2024-11-05T19:05:02.179581 [INFO] The application is running with administrator privileges. -2024-11-05T19:05:01.683940800 [DEBUG] Background mode: false -2024-11-05T19:05:01.667076400 [INFO] Application started -2024-11-05T19:00:49.154460 [INFO] date backup: 05-11-2024 19.00.49 -2024-11-05T19:00:49.144507400 [INFO] Event --> single backup -2024-11-05T19:00:46.007854700 [INFO] You selected the directory: C:\Users\Utente\Desktop -2024-11-05T19:00:41.713023300 [INFO] You selected the file: C:\Users\Utente\Desktop\Stalcraft1.mp4 -2024-11-05T19:00:37.277690200 [INFO] The application is running with administrator privileges. -2024-11-05T19:00:36.758948800 [DEBUG] Background mode: false -2024-11-05T19:00:36.743573100 [INFO] Application started -2024-11-05T18:55:12.152931 [INFO] date backup: 05-11-2024 18.55.12 -2024-11-05T18:55:12.143478600 [INFO] Event --> single backup -2024-11-05T18:55:09.069622100 [INFO] You selected the directory: C:\Users\Utente\Desktop\gg -2024-11-05T18:54:56.369609500 [INFO] You selected the file: C:\Users\Utente\Desktop\token.json -2024-11-05T18:54:50.105948900 [INFO] The application is running with administrator privileges. -2024-11-05T18:54:49.600246400 [DEBUG] Background mode: false -2024-11-05T18:54:49.584870400 [INFO] Application started -2024-11-05T18:52:58.632144 [INFO] The application is running with administrator privileges. -2024-11-05T18:52:57.961110900 [DEBUG] Background mode: false -2024-11-05T18:52:57.945735 [INFO] Application started -2024-11-04T23:48:57.563630900 [INFO] The application is running with administrator privileges. -2024-11-04T23:48:57.068244600 [DEBUG] Background mode: false -2024-11-04T23:48:57.052868100 [INFO] Application started -2024-11-04T23:47:16.346178900 [INFO] The application is running with administrator privileges. -2024-11-04T23:47:15.848069900 [DEBUG] Background mode: false -2024-11-04T23:47:15.832693900 [INFO] Application started -2024-11-04T23:41:21.950697600 [INFO] The application is running with administrator privileges. -2024-11-04T23:41:21.448943700 [DEBUG] Background mode: false -2024-11-04T23:41:21.434063500 [INFO] Application started -2024-11-04T23:32:21.250719700 [INFO] The application is running with administrator privileges. -2024-11-04T23:32:20.754341400 [DEBUG] Background mode: false -2024-11-04T23:32:20.739461400 [INFO] Application started -2024-11-04T23:23:12.899188900 [INFO] The application is running with administrator privileges. -2024-11-04T23:23:12.396437400 [DEBUG] Background mode: false -2024-11-04T23:23:12.380565500 [INFO] Application started -2024-11-04T23:07:28.974244700 [INFO] Event --> opening backup -2024-11-04T23:07:28.967293400 [INFO] Edit row : 0 -2024-11-04T23:07:25.521213100 [INFO] The application is running with administrator privileges. -2024-11-04T23:07:25.009489 [DEBUG] Background mode: false -2024-11-04T23:07:24.993121300 [INFO] Application started -2024-11-04T23:06:20.429811700 [INFO] Event --> opening backup -2024-11-04T23:06:20.423334200 [INFO] Edit row : 0 -2024-11-04T23:06:18.578995200 [INFO] Event --> saving backup -2024-11-04T23:06:17.407310700 [INFO] Event --> opening backup -2024-11-04T23:06:17.401330 [INFO] Edit row : 3 -2024-11-04T23:06:13.339309500 [INFO] Event --> opening backup -2024-11-04T23:06:13.333357400 [INFO] Edit row : 3 -2024-11-04T23:06:11.078171500 [INFO] You selected the directory: C:\Users\Utente\Desktop\AutoBackupProgram -2024-11-04T23:06:07.384350 [INFO] Event --> opening backup -2024-11-04T23:06:07.378398300 [INFO] Edit row : 0 -2024-11-04T23:06:03.472143200 [INFO] Event --> opening backup -2024-11-04T23:06:03.465735600 [INFO] Edit row : 2 -2024-11-04T23:05:58.118683900 [INFO] You selected the directory: C:\Users\Utente\Desktop\AutoBackupProgram -2024-11-04T23:05:51.878202700 [INFO] You selected the directory: C:\Users\Utente\Desktop\gg -2024-11-04T23:05:40.593808 [INFO] Event --> opening backup -2024-11-04T23:05:40.587360200 [INFO] Edit row : 0 -2024-11-04T23:05:38.533739400 [INFO] Event --> opening backup -2024-11-04T23:05:38.528286800 [INFO] Edit row : 1 -2024-11-04T23:05:36.732278800 [INFO] Event --> opening backup -2024-11-04T23:05:36.725334800 [INFO] Edit row : 2 -2024-11-04T23:05:34.396822900 [INFO] Event --> opening backup -2024-11-04T23:05:34.390840600 [INFO] Edit row : 3 -2024-11-04T23:05:31.473699700 [INFO] Event --> saving backup -2024-11-04T23:05:28.216447700 [INFO] Event --> opening backup -2024-11-04T23:05:28.210989 [INFO] Edit row : 1 -2024-11-04T23:05:21.447305200 [INFO] Event --> opening backup -2024-11-04T23:05:21.440831300 [INFO] Edit row : 3 -2024-11-04T23:05:18.048574900 [INFO] Event --> saving backup -2024-11-04T23:05:15.420824800 [INFO] Event --> opening backup -2024-11-04T23:05:15.413880900 [INFO] Edit row : 2 -2024-11-04T23:05:13.552437100 [INFO] Event --> saving backup -2024-11-04T23:05:10.505067300 [INFO] Event --> opening backup -2024-11-04T23:05:10.499583800 [INFO] Edit row : 0 -2024-11-04T23:05:07.080517600 [INFO] Event --> opening backup -2024-11-04T23:05:07.075033100 [INFO] Edit row : 3 -2024-11-04T23:05:04.970131700 [INFO] Event --> opening backup -2024-11-04T23:05:04.964165900 [INFO] Edit row : 1 -2024-11-04T23:04:58.580306 [INFO] Event --> backup renaming -2024-11-04T23:04:50.752919800 [INFO] Event --> backup renaming -2024-11-04T23:04:41.027507400 [INFO] Event --> backup renaming -2024-11-04T23:04:35.072983700 [INFO] Event --> duplicating backup -2024-11-04T23:04:33.154292800 [INFO] Event --> duplicating backup -2024-11-04T23:04:31.345060300 [INFO] Event --> duplicating backup -2024-11-04T23:04:16.771541500 [INFO] The application is running with administrator privileges. -2024-11-04T23:04:16.062007600 [DEBUG] Background mode: false -2024-11-04T23:04:16.045639700 [INFO] Application started -2024-11-02T21:25:31.390764 [INFO] The application is running with administrator privileges. -2024-11-02T21:25:31.129085200 [INFO] Showing the GUI -2024-11-02T21:25:16.522967100 [WARN] Input Error! One or both paths do not exist. -2024-11-02T21:25:16.515031 [INFO] Event --> automatic single backup automatic -2024-11-02T21:25:16.507095300 [INFO] Start backup process. -2024-11-02T21:25:16.495687200 [INFO] Checking for automatic backup... -2024-11-02T21:25:16.487751 [INFO] Time interval set to 1 minutes -2024-11-02T21:25:16.479319 [INFO] TrayIcon added -2024-11-02T21:25:16.247549200 [INFO] Backup service starting in the background -2024-11-02T21:25:16.240608400 [DEBUG] Background mode: true -2024-11-02T21:25:16.227213600 [INFO] Application started -2024-11-02T21:24:57.467039400 [INFO] Event --> saving backup -2024-11-02T21:24:53.691583500 [INFO] Event --> opening backup -2024-11-02T21:24:53.684638800 [INFO] Edit row : 0 -2024-11-02T21:24:48.702722500 [INFO] The application is running with administrator privileges. -2024-11-02T21:24:48.227160600 [DEBUG] Background mode: false -2024-11-02T21:24:48.212908400 [INFO] Application started -2024-11-02T21:24:39.009057300 [DEBUG] Stopping background service -2024-11-02T21:24:38.993048900 [INFO] Background service stopped -2024-11-02T21:24:38.986600600 [DEBUG] Stopping background service -2024-11-02T21:24:00.478946800 [INFO] date backup: 02-11-2024 21.24.00 -2024-11-02T21:24:00.470028800 [INFO] Event --> automatic single backup automatic -2024-11-02T21:24:00.464577400 [INFO] Start backup process. -2024-11-02T21:24:00.457619400 [INFO] Checking for automatic backup... -2024-11-02T21:23:00.462795 [INFO] No backup needed at this time. -2024-11-02T21:23:00.456346200 [INFO] Checking for automatic backup... -2024-11-02T21:22:00.476775900 [INFO] date backup: 02-11-2024 21.22.00 -2024-11-02T21:22:00.470853100 [INFO] Event --> automatic single backup automatic -2024-11-02T21:22:00.464375900 [INFO] Start backup process. -2024-11-02T21:22:00.457927500 [INFO] Checking for automatic backup... -2024-11-02T21:21:00.464538100 [INFO] No backup needed at this time. -2024-11-02T21:21:00.457098400 [INFO] Checking for automatic backup... -2024-11-02T21:20:00.488841 [INFO] date backup: 02-11-2024 21.20.00 -2024-11-02T21:20:00.480434900 [INFO] Event --> automatic single backup automatic -2024-11-02T21:20:00.472480400 [INFO] Start backup process. -2024-11-02T21:20:00.462089 [INFO] Checking for automatic backup... -2024-11-02T21:19:22.592298900 [INFO] Event --> saving backup -2024-11-02T21:19:19.777908300 [INFO] Event --> opening backup -2024-11-02T21:19:19.771459900 [INFO] Edit row : 0 -2024-11-02T21:19:05.752943300 [INFO] The application is running with administrator privileges. -2024-11-02T21:19:05.441759500 [INFO] Showing the GUI -2024-11-02T21:19:00.490624900 [WARN] Input Error! One or both paths do not exist. -2024-11-02T21:19:00.484175400 [INFO] Event --> automatic single backup automatic -2024-11-02T21:19:00.477906 [INFO] Start backup process. -2024-11-02T21:19:00.470900 [INFO] Checking for automatic backup... -2024-11-02T21:18:00.485940500 [WARN] Input Error! One or both paths do not exist. -2024-11-02T21:18:00.479492200 [INFO] Event --> automatic single backup automatic -2024-11-02T21:18:00.473044200 [INFO] Start backup process. -2024-11-02T21:18:00.465108200 [INFO] Checking for automatic backup... -2024-11-02T21:17:00.489993200 [WARN] Input Error! One or both paths do not exist. -2024-11-02T21:17:00.483517400 [INFO] Event --> automatic single backup automatic -2024-11-02T21:17:00.475085100 [INFO] Start backup process. -2024-11-02T21:17:00.464173300 [INFO] Checking for automatic backup... -2024-11-02T21:17:00.454748900 [INFO] Time interval set to 1 minutes -2024-11-02T21:17:00.445325400 [INFO] TrayIcon added -2024-11-02T21:17:00.209306200 [INFO] Backup service starting in the background -2024-11-02T21:17:00.202354500 [DEBUG] Background mode: true -2024-11-02T21:17:00.189433500 [INFO] Application started -2024-11-02T21:16:32.199703900 [INFO] Background service stopped -2024-11-02T21:16:32.193722600 [DEBUG] Stopping background service -2024-11-02T21:15:52.553202800 [ERROR] An error occurred -2024-11-02T21:15:52.546258100 [INFO] date backup: 02-11-2024 21.15.52 -2024-11-02T21:15:52.540305800 [INFO] Event --> automatic single backup automatic -2024-11-02T21:15:52.533886500 [INFO] Start backup process. -2024-11-02T21:15:52.527409300 [INFO] Checking for automatic backup... -2024-11-02T21:14:52.539221 [INFO] No backup needed at this time. -2024-11-02T21:14:52.531780900 [INFO] Checking for automatic backup... -2024-11-02T21:13:52.549402300 [ERROR] An error occurred -2024-11-02T21:13:52.542068800 [INFO] date backup: 02-11-2024 21.13.52 -2024-11-02T21:13:52.536125 [INFO] Event --> automatic single backup automatic -2024-11-02T21:13:52.530164700 [INFO] Start backup process. -2024-11-02T21:13:52.522723600 [INFO] Checking for automatic backup... -2024-11-02T21:12:52.528358 [INFO] No backup needed at this time. -2024-11-02T21:12:52.521441700 [INFO] Checking for automatic backup... -2024-11-02T21:11:52.558380100 [ERROR] An error occurred -2024-11-02T21:11:52.549470900 [INFO] date backup: 02-11-2024 21.11.52 -2024-11-02T21:11:52.543488800 [INFO] Event --> automatic single backup automatic -2024-11-02T21:11:52.537057100 [INFO] Start backup process. -2024-11-02T21:11:52.530592800 [INFO] Checking for automatic backup... -2024-11-02T21:10:52.536367 [INFO] No backup needed at this time. -2024-11-02T21:10:52.529920800 [INFO] Checking for automatic backup... -2024-11-02T21:10:08.534705400 [INFO] Event --> saving backup -2024-11-02T21:10:03.282459400 [INFO] Event --> opening backup -2024-11-02T21:10:03.276479300 [INFO] Edit row : 0 -2024-11-02T21:09:58.113999200 [INFO] The application is running with administrator privileges. -2024-11-02T21:09:57.619551700 [DEBUG] Background mode: false -2024-11-02T21:09:57.605636400 [INFO] Application started -2024-11-02T21:09:52.562889300 [INFO] date backup: 02-11-2024 21.09.52 -2024-11-02T21:09:52.545529400 [INFO] Event --> automatic single backup automatic -2024-11-02T21:09:52.538089900 [INFO] Start backup process. -2024-11-02T21:09:52.525689300 [INFO] Checking for automatic backup... -2024-11-02T21:09:52.517753400 [INFO] Time interval set to 1 minutes -2024-11-02T21:09:52.509817200 [INFO] TrayIcon added -2024-11-02T21:09:52.273507500 [INFO] Backup service starting in the background -2024-11-02T21:09:52.267555600 [DEBUG] Background mode: true -2024-11-02T21:09:52.255183 [INFO] Application started -2024-11-02T21:09:01.126047800 [INFO] The application is running with administrator privileges. -2024-11-02T21:09:00.619141500 [DEBUG] Background mode: false -2024-11-02T21:09:00.604729200 [INFO] Application started -2024-11-02T21:04:13.240918 [INFO] date backup: 02-11-2024 21.04.13 -2024-11-02T21:04:13.222906100 [INFO] Event --> automatic single backup automatic -2024-11-02T21:04:13.215961300 [INFO] Start backup process. -2024-11-02T21:04:13.206041200 [INFO] Checking for automatic backup... -2024-11-02T21:04:13.197637300 [INFO] Time interval set to 1 minutes -2024-11-02T21:04:13.188186100 [INFO] TrayIcon added -2024-11-02T21:04:12.956209900 [INFO] Backup service starting in the background -2024-11-02T21:04:12.950228800 [DEBUG] Background mode: true -2024-11-02T21:04:12.937356200 [INFO] Application started -2024-11-02T21:04:04.778864700 [WARN] Argument "--culo" not valid! -2024-11-02T21:03:54.985795500 [WARN] Argument "--backgrud" not valid! -2024-11-02T21:00:42.429146200 [INFO] The application is running with administrator privileges. -2024-11-02T21:00:41.727533400 [DEBUG] Background mode: false -2024-11-02T21:00:41.719074600 [INFO] Application started -2024-11-02T21:00:41.708658 [WARN] Argument "--sd" not valid! -2024-11-02T20:36:01.076452100 [INFO] The application is running with administrator privileges. -2024-11-02T20:36:00.585967800 [DEBUG] Background mode: false -2024-11-02T20:36:00.571545700 [INFO] Application started -2024-11-02T20:35:07.356738700 [INFO] The application is running with administrator privileges. -2024-11-02T20:35:06.841716 [DEBUG] Background mode: false -2024-11-02T20:35:06.801751500 [INFO] Application started -2024-11-02T18:07:07.277414500 [INFO] date backup: 02-11-2024 18.07.07 -2024-11-02T18:07:07.271438400 [INFO] Event --> automatic single backup automatic -2024-11-02T18:07:07.265017600 [INFO] Start backup process. -2024-11-02T18:07:07.258540600 [INFO] Checking for automatic backup... -2024-11-02T18:06:07.271638900 [INFO] No backup needed at this time. -2024-11-02T18:06:07.263702 [INFO] Checking for automatic backup... -2024-11-02T18:05:52.753355100 [INFO] The application is running with administrator privileges. -2024-11-02T18:05:52.260896500 [DEBUG] Background mode: false -2024-11-02T18:05:52.248000200 [INFO] Application started -2024-11-02T18:05:07.301123500 [INFO] date backup: 02-11-2024 18.05.07 -2024-11-02T18:05:07.281283 [INFO] Event --> automatic single backup automatic -2024-11-02T18:05:07.273347200 [INFO] Start backup process. -2024-11-02T18:05:07.260452 [INFO] Checking for automatic backup... -2024-11-02T18:05:07.250035200 [INFO] Time interval set to 1 minutes -2024-11-02T18:05:07.241107500 [INFO] TrayIcon added -2024-11-02T18:05:07.002630600 [INFO] Backup service starting in the background -2024-11-02T18:05:06.997207300 [DEBUG] Background mode: true -2024-11-02T18:05:06.983783500 [INFO] Application started -2024-11-02T18:02:31.899482600 [INFO] The application is running with administrator privileges. -2024-11-02T18:02:31.393307200 [DEBUG] Background mode: false -2024-11-02T18:02:31.378427300 [INFO] Application started -2024-11-02T17:59:39.646234100 [INFO] The application is running with administrator privileges. -2024-11-02T17:59:39.145860100 [DEBUG] Background mode: false -2024-11-02T17:59:39.131997400 [INFO] Application started -2024-11-02T17:55:06.429246 [INFO] The application is running with administrator privileges. -2024-11-02T17:55:05.943524300 [DEBUG] Background mode: false -2024-11-02T17:55:05.930628100 [INFO] Application started -2024-11-02T17:54:24.349081900 [INFO] The application is running with administrator privileges. -2024-11-02T17:54:23.856296100 [DEBUG] Background mode: false -2024-11-02T17:54:23.842407900 [INFO] Application started -2024-11-02T17:53:59.228944300 [INFO] The application is running with administrator privileges. -2024-11-02T17:53:58.742980100 [DEBUG] Background mode: false -2024-11-02T17:53:58.726115100 [INFO] Application started -2024-11-02T17:50:18.816012 [INFO] Background service stopped -2024-11-02T17:50:18.808571900 [DEBUG] Stopping background service -2024-11-02T17:50:10.455325100 [INFO] date backup: 02-11-2024 17.50.10 -2024-11-02T17:50:10.449893700 [INFO] Event --> automatic single backup automatic -2024-11-02T17:50:10.443945200 [INFO] Start backup process. -2024-11-02T17:50:10.437497 [INFO] Checking for automatic backup... -2024-11-02T17:49:10.448448500 [INFO] No backup needed at this time. -2024-11-02T17:49:10.442468800 [INFO] Checking for automatic backup... -2024-11-02T17:49:03.221906400 [INFO] date backup: 02-11-2024 17.49.03 -2024-11-02T17:49:03.214432500 [INFO] Event --> single backup -2024-11-02T17:49:02.021447900 [INFO] Event --> opening backup -2024-11-02T17:49:02.013980900 [INFO] Edit row : 0 -2024-11-02T17:48:59.405292700 [INFO] The application is running with administrator privileges. -2024-11-02T17:48:58.912849800 [DEBUG] Background mode: false -2024-11-02T17:48:58.898312900 [INFO] Application started -2024-11-02T17:48:46.783531100 [INFO] date backup: 02-11-2024 17.48.46 -2024-11-02T17:48:46.776091100 [INFO] Event --> single backup -2024-11-02T17:48:45.851510500 [INFO] Event --> opening backup -2024-11-02T17:48:45.846026200 [INFO] Edit row : 0 -2024-11-02T17:48:43.851682800 [INFO] The application is running with administrator privileges. -2024-11-02T17:48:43.363005900 [DEBUG] Background mode: false -2024-11-02T17:48:43.349613400 [INFO] Application started -2024-11-02T17:48:10.450884600 [INFO] No backup needed at this time. -2024-11-02T17:48:10.443445400 [INFO] Checking for automatic backup... -2024-11-02T17:47:20.596734100 [INFO] date backup: 02-11-2024 17.47.20 -2024-11-02T17:47:20.589294300 [INFO] Event --> single backup -2024-11-02T17:47:10.461171100 [INFO] date backup: 02-11-2024 17.47.10 -2024-11-02T17:47:10.455714 [INFO] Event --> automatic single backup automatic -2024-11-02T17:47:10.450098400 [INFO] Start backup process. -2024-11-02T17:47:10.444174200 [INFO] Checking for automatic backup... -2024-11-02T17:47:10.180147900 [INFO] Event --> opening backup -2024-11-02T17:47:10.175163300 [INFO] Edit row : 0 -2024-11-02T17:47:06.091320700 [INFO] The application is running with administrator privileges. -2024-11-02T17:47:05.593063600 [DEBUG] Background mode: false -2024-11-02T17:47:05.577593200 [INFO] Application started -2024-11-02T17:46:10.448400100 [INFO] No backup needed at this time. -2024-11-02T17:46:10.442448200 [INFO] Checking for automatic backup... -2024-11-02T17:45:10.468217800 [INFO] date backup: 02-11-2024 17.45.10 -2024-11-02T17:45:10.452340300 [INFO] Event --> automatic single backup automatic -2024-11-02T17:45:10.445835400 [INFO] Start backup process. -2024-11-02T17:45:10.439870600 [INFO] Checking for automatic backup... -2024-11-02T17:44:10.648465100 [INFO] TrayIcon added -2024-11-02T17:44:10.448459700 [INFO] No backup needed at this time. -2024-11-02T17:44:10.439035600 [INFO] Checking for automatic backup... -2024-11-02T17:44:10.432127200 [INFO] Time interval set to 1 minutes -2024-11-02T17:44:10.422944800 [INFO] Backup service starting in the background -2024-11-02T17:44:10.417984800 [DEBUG] Background mode: true -2024-11-02T17:44:10.407072800 [INFO] Application started -2024-11-02T17:43:52.320304900 [INFO] The application is running with administrator privileges. -2024-11-02T17:43:51.824564 [DEBUG] Background mode: false -2024-11-02T17:43:51.810180 [INFO] Application started -2024-11-02T17:43:33.205409700 [INFO] Background service stopped -2024-11-02T17:43:33.198962300 [DEBUG] Stopping background service -2024-11-02T17:43:16.212533100 [INFO] TrayIcon added -2024-11-02T17:43:16.049609400 [INFO] date backup: 02-11-2024 17.43.16 -2024-11-02T17:43:16.034209700 [INFO] Event --> automatic single backup automatic -2024-11-02T17:43:15.999985 [INFO] Start backup process. -2024-11-02T17:43:15.991060200 [INFO] Checking for automatic backup... -2024-11-02T17:43:15.983559700 [INFO] Time interval set to 1 minutes -2024-11-02T17:43:15.973639700 [INFO] Backup service starting in the background -2024-11-02T17:43:15.969175700 [DEBUG] Background mode: true -2024-11-02T17:43:15.959255800 [INFO] Application started -2024-11-02T17:43:05.891601200 [INFO] The application is running with administrator privileges. -2024-11-02T17:43:05.203189 [DEBUG] Background mode: false -2024-11-02T17:43:05.192308 [INFO] Application started -2024-11-02T17:41:41.310909300 [INFO] The application is running with administrator privileges. -2024-11-02T17:41:40.822127300 [DEBUG] Background mode: false -2024-11-02T17:41:40.810251500 [INFO] Application started -2024-11-02T17:41:22.516224600 [INFO] The application is running with administrator privileges. -2024-11-02T17:41:22.028803300 [DEBUG] Background mode: false -2024-11-02T17:41:22.016871400 [INFO] Application started -2024-11-02T17:40:50.257330400 [INFO] The application is running with administrator privileges. -2024-11-02T17:40:48.763955400 [DEBUG] Background mode: false -2024-11-02T17:40:48.752548600 [INFO] Application started -Exception: java.nio.file.NoSuchFileException - C:\Users\Utente\Desktop\fg - at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38) - at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:197) - at java.base/java.nio.file.Files.readAttributes(Files.java:1858) - at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220) - at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277) - at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:323) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2784) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2862) - at com.mycompany.autobackupprogram.BackupOperations.lambda$zipDirectory$0(BackupOperations.java:146) - at java.base/java.lang.Thread.run(Thread.java:1570) -Exception: java.nio.file.NoSuchFileException - C:\Users\Utente\Desktop\fg - at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38) - at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:197) - at java.base/java.nio.file.Files.readAttributes(Files.java:1858) - at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220) - at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277) - at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:323) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2784) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2862) - at com.mycompany.autobackupprogram.BackupOperations.lambda$zipDirectory$0(BackupOperations.java:146) - at java.base/java.lang.Thread.run(Thread.java:1570) -Exception: java.nio.file.NoSuchFileException - C:\Users\Utente\Desktop\fg - at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) - at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53) - at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38) - at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:197) - at java.base/java.nio.file.Files.readAttributes(Files.java:1858) - at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220) - at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277) - at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:323) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2784) - at java.base/java.nio.file.Files.walkFileTree(Files.java:2862) - at com.mycompany.autobackupprogram.BackupOperations.lambda$zipDirectory$0(BackupOperations.java:146) - at java.base/java.lang.Thread.run(Thread.java:1570) +2024-11-06T22:12:07.702346500 [INFO] The application is running with administrator privileges. +2024-11-06T22:12:06.921945400 [DEBUG] Background mode: false +2024-11-06T22:12:06.908553400 [INFO] Application started +2024-11-06T15:31:47.086822800 [INFO] The application is running with administrator privileges. +2024-11-06T15:31:46.607667200 [DEBUG] Background mode: false +2024-11-06T15:31:46.595762100 [INFO] Application started diff --git a/src/test/java/test/AutoBackupProgramTest.java b/src/test/java/test/AutoBackupProgramTest.java deleted file mode 100644 index 1b7f834..0000000 --- a/src/test/java/test/AutoBackupProgramTest.java +++ /dev/null @@ -1,136 +0,0 @@ -//package com.mycompany.autobackupprogram; -// -//import org.junit.jupiter.api.AfterEach; -//import org.junit.jupiter.api.Test; -//import org.junit.jupiter.api.DisplayName; -// -//import static org.junit.jupiter.api.Assertions.assertEquals; -//import static org.junit.jupiter.api.Assertions.assertNotNull; -//import static org.junit.jupiter.api.Assertions.assertTrue; -// -//class AutoBackupProgramTest { -// -// private AutoBackupProgram program; -// -// @BeforeEach -// void setup() { -// program = new AutoBackupProgram(); -// } -// -// @AfterEach -// void tearDown() { -// program = null; -// } -// -// @Test -// @DisplayName("Test clear method") -// void testClear() { -// program.Clear(); -// assertEquals(0, program.getFiles().size()); -// } -// -// @Test -// @DisplayName("Test exit method") -// void testExit() { -// program.Exit(); -// assertTrue(program.isExited()); -// } -// -// @Test -// @DisplayName("Test help method") -// void testHelp() { -// program.Help(); -// assertTrue(program.isHelpDisplayed()); -// } -// -// @Test -// @DisplayName("Test credits method") -// void testCredits() { -// program.Credits(); -// assertTrue(program.isCreditsDisplayed()); -// } -// -// @Test -// @DisplayName("Test share method") -// void testShare() { -// program.Share(); -// assertTrue(program.isShared()); -// } -// -// @Test -// @DisplayName("Test view history method") -// void testViewHistory() { -// program.ViewHistory(); -// assertTrue(program.isHistoryViewed()); -// } -// -// @Test -// @DisplayName("Test new file method") -// void testNewFile() { -// program.NewFile(); -// assertTrue(program.isFileCreated()); -// } -// -// @Test -// @DisplayName("Test remove single file method") -// void testRemoveSingleFile() { -// program.RemoveSingleFile(); -// assertTrue(program.isFileRemoved()); -// } -// -// @Test -// @DisplayName("Test save with name method") -// void testSaveWithName() { -// program.SaveWithName(); -// assertTrue(program.isSavedWithName()); -// } -// -// @Test -// @DisplayName("Test save method") -// void testSave() { -// program.Save(); -// assertTrue(program.isSaved()); -// } -// -// @Test -// @DisplayName("Test backup list method") -// void testBackupList() { -// program.BackupList(); -// assertTrue(program.isBackupListDisplayed()); -// } -// -// @Test -// @DisplayName("Test single backup method") -// void testSingleBackup() { -// program.SingleBackup(); -// assertTrue(program.isSingleBackupPerformed()); -// } -// -// @Test -// @DisplayName("Test automatic backup method") -// void testAutomaticBackup() { -// program.AutomaticBackup(); -// assertTrue(program.isAutomaticBackupPerformed()); -// } -// -// @Test -// @DisplayName("Test change BTN auto backup option method") -// void testChangeBTNAutoBackupOption() { -// program.ChangeBTNAutoBackupOption(); -// assertTrue(program.isAutoBackupOptionChanged()); -// } -// -// @Test -// @DisplayName("Test get string to text method") -// void testGetStringToText() { -// program.GetStringToText(); -// assertNotNull(program.getStringToText()); -// } -// -// @Test -// @DisplayName("Test check input correct method") -// void testCheckInputCorrect() { -// program.checkInputCorrect(); -// assertTrue(program.isInputCorrect()); -// } -//} diff --git a/src/test/java/test/TestBackupManagerGUI.java b/src/test/java/test/TestBackupManagerGUI.java new file mode 100644 index 0000000..1c01b6a --- /dev/null +++ b/src/test/java/test/TestBackupManagerGUI.java @@ -0,0 +1,21 @@ +package test; + +import com.mycompany.autobackupprogram.BackupManagerGUI; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.AfterEach; + +public class TestBackupManagerGUI { + + private BackupManagerGUI program; + + @BeforeEach + void setup() { + program = new BackupManagerGUI(); + } + + @AfterEach + void tearDown() { + program = null; + } +} \ No newline at end of file diff --git a/src/test/java/test/TestConfigKey.java b/src/test/java/test/TestConfigKey.java new file mode 100644 index 0000000..0b88d83 --- /dev/null +++ b/src/test/java/test/TestConfigKey.java @@ -0,0 +1,141 @@ +package test; + +import com.mycompany.autobackupprogram.ConfigKey; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.io.IOException; + +public class TestConfigKey { + + private final String LOG_FILE_STRING = "log_file"; + private final String BACKUP_FILE_STRING = "backup_list.json"; + private final String CONFIG_FILE_STRING = "config.json"; + private final String RES_DIRECTORY_STRING = "src/main/resources/res/"; + private final String DONATE_PAGE_LINK = "https://buymeacoffee.com/denno"; + private final String ISSUE_PAGE_LINK = "https://github.com/DennisTurco/BackupManager/issues"; + private final String INFO_PAGE_LINK = "https://github.com/DennisTurco/BackupManager"; + private final String SHARD_WEBSITE = "https://www.shardpc.it/"; + private final String LOGO_IMG = "/res/img/logo.png"; + private final String SHARE_LINK = "https://github.com/DennisTurco/BackupManager/releases"; + private final String EMAIL = "assistenza@shardpc.it"; + + private static final String TEST_JSON_PATH = "src/test/resources/config_test.json"; + + @BeforeEach + void setup() throws IOException { + // json test + String jsonContent = String.format(""" + { + "LOG_FILE_STRING": "%s", + "BACKUP_FILE_STRING": "%s", + "CONFIG_FILE_STRING": "%s", + "RES_DIRECTORY_STRING": "%s", + "DONATE_PAGE_LINK": "%s", + "ISSUE_PAGE_LINK": "%s", + "INFO_PAGE_LINK": "%s", + "EMAIL": "%s", + "SHARD_WEBSITE": "%s", + "LOGO_IMG": "%s", + "SHARE_LINK": "%s" + }""", + LOG_FILE_STRING, + BACKUP_FILE_STRING, + CONFIG_FILE_STRING, + RES_DIRECTORY_STRING, + DONATE_PAGE_LINK, + ISSUE_PAGE_LINK, + INFO_PAGE_LINK, + EMAIL, + SHARD_WEBSITE, + LOGO_IMG, + SHARE_LINK); + + // write json test + Files.createDirectories(Paths.get("src/test/resources")); + Files.write(Paths.get(TEST_JSON_PATH), jsonContent.getBytes()); + } + + @Test + void testLoadFromJson() { + // load the values from JSON test + ConfigKey.loadFromJson(TEST_JSON_PATH); + + // check if the values are correctly loaded + assertEquals(LOG_FILE_STRING, ConfigKey.LOG_FILE_STRING.getValue()); + assertEquals(BACKUP_FILE_STRING, ConfigKey.BACKUP_FILE_STRING.getValue()); + assertEquals(CONFIG_FILE_STRING, ConfigKey.CONFIG_FILE_STRING.getValue()); + assertEquals(RES_DIRECTORY_STRING, ConfigKey.RES_DIRECTORY_STRING.getValue()); + assertEquals(DONATE_PAGE_LINK, ConfigKey.DONATE_PAGE_LINK.getValue()); + assertEquals(ISSUE_PAGE_LINK, ConfigKey.ISSUE_PAGE_LINK.getValue()); + assertEquals(INFO_PAGE_LINK, ConfigKey.INFO_PAGE_LINK.getValue()); + assertEquals(EMAIL, ConfigKey.EMAIL.getValue()); + assertEquals(SHARD_WEBSITE, ConfigKey.SHARD_WEBSITE.getValue()); + assertEquals(LOGO_IMG, ConfigKey.LOGO_IMG.getValue()); + assertEquals(SHARE_LINK, ConfigKey.SHARE_LINK.getValue()); + } + + @Test + void testMissingKeys() { + String jsonContent = String.format(""" + { + "LOG_FILE_STRING": "log_file", + "BACKUP_FILE_STRING": "backup_list.json" + }""", + LOGO_IMG, + BACKUP_FILE_STRING); + + try { + Files.write(Paths.get(TEST_JSON_PATH), jsonContent.getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } + + // load the values + ConfigKey.loadFromJson(TEST_JSON_PATH); + + // checks + assertNull(ConfigKey.CONFIG_FILE_STRING.getValue()); + assertNull(ConfigKey.RES_DIRECTORY_STRING.getValue()); + assertNull(ConfigKey.DONATE_PAGE_LINK.getValue()); + } + + @Test + void testEmptyJsonFile() { + String emptyJsonContent = "{}"; + try { + Files.write(Paths.get(TEST_JSON_PATH), emptyJsonContent.getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } + + ConfigKey.loadFromJson(TEST_JSON_PATH); + + assertEquals("log_file", ConfigKey.LOG_FILE_STRING.getValue()); + assertEquals("backup_list.json", ConfigKey.BACKUP_FILE_STRING.getValue()); + } + + @Test + void testJsonParsingException() { + // Test JSON error + String malformedJson = """ + { + "LOG_FILE_STRING": "log_file", + "BACKUP_FILE_STRING": "backup_list.json" + """; // JSON error ('}' is missing) + + try { + Files.write(Paths.get(TEST_JSON_PATH), malformedJson.getBytes()); + } catch (IOException e) { + e.printStackTrace(); + } + + ConfigKey.loadFromJson(TEST_JSON_PATH); + assertEquals("log_file", ConfigKey.LOG_FILE_STRING.getValue()); + assertEquals("backup_list.json", ConfigKey.BACKUP_FILE_STRING.getValue()); + } +} diff --git a/src/test/java/test/TestLogger.java b/src/test/java/test/TestLogger.java new file mode 100644 index 0000000..55cf1eb --- /dev/null +++ b/src/test/java/test/TestLogger.java @@ -0,0 +1,139 @@ +//package test; +// +//import com.mycompany.autobackupprogram.JSONConfigReader; +//import com.mycompany.autobackupprogram.Logger; +//import org.junit.jupiter.api.*; +//import org.mockito.*; +// +//import java.io.*; +//import java.nio.file.*; +//import java.util.List; +// +//import static org.junit.jupiter.api.Assertions.*; +//import static org.mockito.Mockito.*; +// +//public class TestLogger { +// +// private static final String TEST_LOG_PATH = "src/main/resources/res/test_log"; +// private static final String TEST_JSON_PATH = "src/main/resources/res/test_config.json"; +// +// @Mock +// private static JSONConfigReader mockConfigReader; +// +// @BeforeAll +// static void setUpBeforeClass() throws IOException { +// // Create test configuration file +// String jsonContent = """ +// { +// "LogService": { +// "ERROR": true, +// "INFO": true, +// "WARN": true, +// "DEBUG": true, +// "MaxLines": { +// "value": 1500, +// "type": "int", +// "description": "Maximum number of logs for the file" +// }, +// "LinesToKeepAfterFileClear": { +// "value": 150, +// "type": "int", +// "description": "Lines to keep after file clear" +// } +// } +// }"""; +// Files.write(Paths.get(TEST_JSON_PATH), jsonContent.getBytes()); +// +// // Set up the mock config reader +// mockConfigReader = mock(JSONConfigReader.class); +// when(mockConfigReader.getMaxLines()).thenReturn(100); +// when(mockConfigReader.getLinesToKeepAfterFileClear()).thenReturn(50); +// when(mockConfigReader.isLogLevelEnabled("INFO")).thenReturn(true); +// when(mockConfigReader.isLogLevelEnabled("DEBUG")).thenReturn(true); +// when(mockConfigReader.isLogLevelEnabled("WARN")).thenReturn(true); +// when(mockConfigReader.isLogLevelEnabled("ERROR")).thenReturn(true); +// +// Logger.configReader = mockConfigReader; +// } +// +// @BeforeEach +// void setup() { +// // Reset the console logging flag before each test +// Logger.setConsoleLoggingEnabled(false); +// } +// +// @Test +// void testLogMessageInfoLevel() throws IOException { +// Logger.logMessage("Test info message", Logger.LogLevel.INFO); +// +// List lines = Files.readAllLines(Paths.get(TEST_LOG_PATH)); +// System.out.println(lines.toString()); +// assertTrue(lines.stream().anyMatch(line -> line.contains("INFO"))); +// } +// +// @Test +// void testLogMessageDebugLevel() throws IOException { +// Logger.logMessage("Test debug message", Logger.LogLevel.DEBUG); +// +// List lines = Files.readAllLines(Paths.get(TEST_LOG_PATH)); +// assertTrue(lines.stream().anyMatch(line -> line.contains("DEBUG") && line.contains("Test debug message"))); +// } +// +// @Test +// void testLogMessageErrorLevel() throws IOException { +// Logger.logMessage("Test error message", Logger.LogLevel.ERROR); +// +// List lines = Files.readAllLines(Paths.get(TEST_LOG_PATH)); +// assertTrue(lines.stream().anyMatch(line -> line.contains("ERROR") && line.contains("Test error message"))); +// } +// +// @Test +// void testLogMessageWithException() throws IOException { +// Exception testException = new Exception("Test exception"); +// Logger.logMessage("Test message with exception", Logger.LogLevel.ERROR, testException); +// +// List lines = Files.readAllLines(Paths.get(TEST_LOG_PATH)); +// assertTrue(lines.stream().anyMatch(line -> line.contains("ERROR") && line.contains("Test message with exception"))); +// assertTrue(lines.stream().anyMatch(line -> line.contains("Exception: java.lang.Exception - Test exception"))); +// } +// +// @Test +// void testConsoleLoggingEnabled() { +// Logger.setConsoleLoggingEnabled(true); +// +// // Capture the console output +// PrintStream originalOut = System.out; +// ByteArrayOutputStream consoleOutput = new ByteArrayOutputStream(); +// System.setOut(new PrintStream(consoleOutput)); +// +// Logger.logMessage("Test console logging", Logger.LogLevel.INFO); +// +// assertTrue(consoleOutput.toString().contains("Test console logging")); +// +// // Reset the console output +// System.setOut(originalOut); +// } +// +// @Test +// void testFileLoggingWithMaxLines() throws IOException { +// // Create a large number of log entries to test maxLines +// for (int i = 0; i < 200; i++) { +// Logger.logMessage("Log entry " + i, Logger.LogLevel.INFO); +// } +// +// List lines = Files.readAllLines(Paths.get(TEST_LOG_PATH)); +// assertEquals(100, lines.size()); // After trimming, only 100 lines should remain +// } +// +// @AfterEach +// void tearDown() throws IOException { +// // Clean up log file after each test +// Files.deleteIfExists(Paths.get(TEST_LOG_PATH)); +// } +// +// @AfterAll +// static void tearDownAfterClass() throws IOException { +// // Clean up the config file after all tests +// Files.deleteIfExists(Paths.get(TEST_JSON_PATH)); +// } +//} diff --git a/src/test/resources/config_test.json b/src/test/resources/config_test.json new file mode 100644 index 0000000..69e56d9 --- /dev/null +++ b/src/test/resources/config_test.json @@ -0,0 +1,3 @@ +{ +"LOG_FILE_STRING": "log_file", +"BACKUP_FILE_STRING": "backup_list.json"