diff --git a/.classpath b/.classpath
index 842ea18..8af02c6 100644
--- a/.classpath
+++ b/.classpath
@@ -20,5 +20,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/august-edge-427718-m0-6298e03aba4c.json b/august-edge-427718-m0-6298e03aba4c.json
new file mode 100644
index 0000000..49436ff
--- /dev/null
+++ b/august-edge-427718-m0-6298e03aba4c.json
@@ -0,0 +1,13 @@
+{
+ "type": "service_account",
+ "project_id": "august-edge-427718-m0",
+ "private_key_id": "6298e03aba4c16bea70a320892385d4df2c7464d",
+ "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDJiMz6mdSjEKNS\nj7gAqwTezhq4ZWTlgKIYIR47246FjVOYpxIfqVv/eDvDub5zgLh1u/6m0RP13AGU\nthqnr21i1ozCKa5eOnh5XMMQwUX4m793q3bVGAKks3rUZh9DJerLNWOZnVPMyblw\n0kJsRS2DcGuysXgrfaV0BW7P2+S9Vg0BKPEY6FGTZh4BkbhaWMSFLBBzTcn6Qgqr\nqVgDmOZHMDRvANPKCGk3aHRd495RHJx7N7DL17JbF6zlHLZFT3j/n5qDfhVtmokd\n+pDqDfepJinnKUKmh5TS+kJbZ69GPLCMxuPeghXu98Av10b8+5hAfu+r6Y2+00kF\n9DpNYbBrAgMBAAECggEAP44cMlVryMbY8pLvMIq+PPNbWtZi9LtVou1ixvas4fIZ\nMFVTsldq80w78LP1WyB3S22vV3Us6cZpWzf4fPQmN1q4xgx1+DJRRtiZjYGd6tJX\nFcqlbXsmbkFJlYzlA/yDqHTcRZfnUvg0ul8cYl+IhGBiHla4MmLr2ARUl0ldv9VB\nP7rphqGhsOQn78Qwj3330wjf+zcqKF8JVL+V5NrSdflfXuiVeVNJWjlrXDUBrwVv\n9VX9TjSD/MenCa5xXpMzoMlCzrguYPfx7H26B3YJEh6TQrQhhsUBXk8ZA7xznJvm\nkND0uA2BMR3nkLadsBXjwgsTvIUjLWBS8AZoRZ61MQKBgQDw0PFW60FVdiDo4Ny7\nklO2iyYqqZEQ93bdZN8L5HKPnk5PuaKxUp6XY5fDXNTqMTdUkIR9UQQWIq0chRDm\n63uDpfMgQCZLF4KnVP/Qy0oW5uxNMtjLrMfOdQSK/6/fvek/lGvmHCXFiP1sDa9w\n7pLkY9+OFshKWffXYc4S5uaXOwKBgQDWPc2k5fzYP6hNbM8FHxdKOZtvQnLv84Mr\nyvTM2aItAY9jYGPYp+XAZKRiLjJjBxPcaP6QyrQrsM/wKaznOdBdIBb+tpNZoPjy\nobMhg3+T72LAdAkQx/xOdGYIrafgkDdPJVZL2bThosnlEUn8ux7coH5vgP2q/TZb\njspPT0GYkQKBgFIfHr4CWfRX5V8lF4ELpGqSx0AzNRoxGaLkPD/k9sBNPu1nI7kO\nsLB1sRJZPO5kPDclVVka4KbfymL4acwlr6g0VlXAKo7fBJolnVtJiAmJVDn7Rf0m\n/bhFJXh1Oze0nq8k4SrGnIbhcXKAtDxxzzv9ZwYgdMsOJTuYydqeTTJzAoGAJ/KG\nMcUgjEHyY91yDIZrlU+AiBJf1BYX00aYtsmtz66GygTjGTbVRDZ/4D607noXXfXF\n4cGqLqtdWm6q6sKA85xULVJlz0SQps031Xvrge4U/8WjGxnvFcHmdJ/MubaqWXug\nx6vkal4sPyYmIZXSf1j9ulTW99cXF6NcXcVtecECgYEAgHpXlGGDWfk6DDggxcl9\nLRosvqmxYRiJTO6KBS2SeOuhhdgiXeh5Ddk2WuojVb+TOX72EwJ7fPvu3+OtFiW7\nQ/OSKqWQDjGrJeNhdGv8T1/O87TgsHKsvhPyypkl4+6KY0Hv8WDmUTRjR9V12Oti\nGGcpq5MG80nNJYIupaDGoH0=\n-----END PRIVATE KEY-----\n",
+ "client_email": "drivebaseegass@august-edge-427718-m0.iam.gserviceaccount.com",
+ "client_id": "108257985217466952219",
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
+ "token_uri": "https://oauth2.googleapis.com/token",
+ "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
+ "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/drivebaseegass%40august-edge-427718-m0.iam.gserviceaccount.com",
+ "universe_domain": "googleapis.com"
+}
diff --git a/base/archiveBase.zip b/base/archiveBase.zip
index 9ed2659..97471ed 100644
Binary files a/base/archiveBase.zip and b/base/archiveBase.zip differ
diff --git a/base/base.xml b/base/base.xml
index bf2b339..dfdad91 100644
--- a/base/base.xml
+++ b/base/base.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/base/base_sauvegarde.xml b/base/base_sauvegarde.xml
index 7e0a4f7..73cea73 100644
--- a/base/base_sauvegarde.xml
+++ b/base/base_sauvegarde.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/Windows/Window_Help_download_and_install.java b/src/Windows/Window_Help_download_and_install.java
index 8d1b724..4553ff9 100644
--- a/src/Windows/Window_Help_download_and_install.java
+++ b/src/Windows/Window_Help_download_and_install.java
@@ -1,9 +1,10 @@
package Windows;
+import java.awt.BorderLayout;
+
+import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
-import java.awt.BorderLayout;
-import javax.swing.ImageIcon;
import javax.swing.SwingConstants;
public class Window_Help_download_and_install extends JFrame{
diff --git a/src/Windows/Window_Help_maj_data.java b/src/Windows/Window_Help_maj_data.java
index e1bca26..59d4df2 100644
--- a/src/Windows/Window_Help_maj_data.java
+++ b/src/Windows/Window_Help_maj_data.java
@@ -1,9 +1,10 @@
package Windows;
+import java.awt.BorderLayout;
+
+import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
-import java.awt.BorderLayout;
-import javax.swing.ImageIcon;
import javax.swing.SwingConstants;
public class Window_Help_maj_data extends JFrame{
diff --git a/src/Windows/Window_demarre.java b/src/Windows/Window_demarre.java
index 627d1e5..5560ce2 100644
--- a/src/Windows/Window_demarre.java
+++ b/src/Windows/Window_demarre.java
@@ -55,7 +55,7 @@ public class Window_demarre extends JFrame {
JButton btnGestionnaire = new JButton("");
JButton btnLicence = new JButton("Licence GNU GPL 3.0");
JButton btnimporterDesInscriptionsdepuisClasseur = new JButton("Importer des inscriptions
depuis un classeur Ms Excel");
- static JLabel lblAuteurVersion = new JLabel("Pablo Rodriguez - 2023
Version "+ commandes.version+"");
+ static JLabel lblAuteurVersion = new JLabel("Pablo Rodriguez - 2024
Version "+ commandes.version+"");
static JLabel lblFondImage = new JLabel();
@@ -113,7 +113,7 @@ public class Window_demarre extends JFrame {
}
};
- // Planification de la tâche de sauvegarde automatique à exécuter toutes les 2 minutes 2 * 60 * 1000
+ // Planification de la tâche de sauvegarde automatique à exécuter toutes les 5 minutes : 5 * 60 * 1000
timer.schedule(autoSaveTask, 0, commandes.nombreMinuteEntreDeuxSauvegarde * 60 * 1000);
// Affichage des messages de version ou d'information
@@ -556,6 +556,7 @@ public class Window_demarre extends JFrame {
private static void affichageImageDeFond() {
Random random = new Random();
int randomNumber = random.nextInt(commandes.nombreImage) + 1;
+// randomNumber=42;
ImageIcon imageIcon = new ImageIcon(Window_demarre.class.getResource("/resources/Sans titre_"+ String.valueOf(randomNumber) +".jpg"));
Image image = imageIcon.getImage();
@@ -572,7 +573,7 @@ public class Window_demarre extends JFrame {
|| randomNumber==10 || randomNumber==11 || randomNumber==12
|| randomNumber==14 || randomNumber==18 || randomNumber==21
|| randomNumber==22 || randomNumber==23 || randomNumber==25
- || randomNumber==27 || randomNumber==28
+ || randomNumber==27 || randomNumber==28 || randomNumber ==42
) {
lblAuteurVersion.setForeground(new Color(0, 0, 0));
}else {
diff --git a/src/Windows/Window_renommerColonne.java b/src/Windows/Window_renommerColonne.java
index 968ce31..10f6215 100644
--- a/src/Windows/Window_renommerColonne.java
+++ b/src/Windows/Window_renommerColonne.java
@@ -11,6 +11,7 @@ import java.util.Random;
import javax.swing.ImageIcon;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -20,7 +21,6 @@ import javax.swing.border.EmptyBorder;
import base.NomDeColonneInscriptionTable;
import outils.commandes;
-import javax.swing.JCheckBox;
/**
* Fenêtre permettant de changer les paramètres (nom de la feuille, noms des colonnes).
diff --git a/src/base/recupeBases.java b/src/base/recupeBases.java
index 6c4fa1b..d2e62fd 100644
--- a/src/base/recupeBases.java
+++ b/src/base/recupeBases.java
@@ -29,6 +29,8 @@ public class recupeBases {
nBase = lectureXML.lectureStringToNoeud(xmlString);
} else {
+ // création d'une nouvelle base
+ nBase = base.createBase();
JFrame frame = new JFrame();
JLabel texte = new JLabel("
La base de données ne se trouve pas dans le même dossier que celui de l'application.
"
@@ -38,8 +40,6 @@ public class recupeBases {
+ "Vous allez devoir saisir l'année universitaire pour débuter et créer la base.
");
JOptionPane.showMessageDialog(frame, texte);
- // création d'une nouvelle base
- nBase = base.createBase();
}
return nBase;
diff --git a/src/google/GoogleDriveService.java b/src/google/GoogleDriveService.java
new file mode 100644
index 0000000..9105cb9
--- /dev/null
+++ b/src/google/GoogleDriveService.java
@@ -0,0 +1,97 @@
+package google;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.gson.GsonFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.DriveScopes;
+
+
+public class GoogleDriveService {
+ private static final String APPLICATION_NAME = "My Project 89246";
+ private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();
+ private static final String TOKENS_DIRECTORY_PATH = "C:/Users/pabr6/eclipse-workspace/baseStudentUFRHG/tokens"; // Répertoire pour stocker les jetons
+
+ private static final List SCOPES = Collections.singletonList(DriveScopes.DRIVE);
+ private static final String CREDENTIALS_FILE_PATH = "/resources/august-edge-427718-m0-6298e03aba4c.json"; // Chemin relatif au répertoire resources
+
+ public static Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT) throws Exception {
+ InputStream in = GoogleDriveService.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
+ if (in == null) {
+ throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
+ }
+
+ // Debug: Afficher le contenu du fichier credentials.json
+ InputStreamReader reader = new InputStreamReader(in);
+ StringBuilder jsonContent = new StringBuilder();
+ int data;
+ while ((data = reader.read()) != -1) {
+ jsonContent.append((char) data);
+ }
+ System.out.println("Credentials JSON content: " + jsonContent.toString());
+
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(new ByteArrayInputStream(jsonContent.toString().getBytes(StandardCharsets.UTF_8))));
+
+ File fileTokens = new java.io.File(TOKENS_DIRECTORY_PATH);
+
+ try {
+ // Vérifie si le répertoire des tokens existe
+ if (!fileTokens.exists()) {
+ // Tentative de création du répertoire
+ if (!fileTokens.mkdirs()) {
+ throw new IOException("Impossible de créer le répertoire des tokens : " + TOKENS_DIRECTORY_PATH);
+ }
+ }
+
+ // Vérifie de nouveau l'existence du répertoire après tentative de création
+ if (fileTokens.exists()) {
+ // Affiche les informations sur le répertoire des tokens
+ System.out.println("Répertoire des tokens : " + fileTokens.getAbsolutePath());
+
+ // Construit le flux d'autorisation Google
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
+ .setDataStoreFactory(new FileDataStoreFactory(fileTokens))
+ .setAccessType("offline")
+ .build();
+
+ // Crée le récepteur local pour la réception du code d'autorisation
+ LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
+
+ // Autorise l'application à accéder aux services Google au nom de l'utilisateur
+ return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
+ } else {
+ throw new IOException("Répertoire des tokens inexistant : " + TOKENS_DIRECTORY_PATH);
+ }
+ } catch (IOException e) {
+ System.err.println("Erreur lors de la gestion du répertoire des tokens : " + e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+
+ public static Drive getDriveService() throws Exception {
+ final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
+ return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
+ .setApplicationName(APPLICATION_NAME)
+ .build();
+ }
+}
diff --git a/src/google/GoogleDriveXmlManager.java b/src/google/GoogleDriveXmlManager.java
new file mode 100644
index 0000000..ac816ae
--- /dev/null
+++ b/src/google/GoogleDriveXmlManager.java
@@ -0,0 +1,46 @@
+package google;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import com.google.api.services.drive.Drive;
+import com.google.api.services.drive.model.File;
+
+
+public class GoogleDriveXmlManager {
+
+ private static final String FILE_ID = "1lX56oXzQQk9nZu7DAlU0eqcVLqqSo-ab";
+
+ public static void main(String[] args) throws Exception {
+ Drive service = GoogleDriveService.getDriveService();
+
+ // Step 1: Download the file
+ Path tempFile = downloadFile(service, FILE_ID);
+
+ // Step 2: Parse and modify the XML file
+
+
+
+
+ // Step 4: Upload the modified file back to Google Drive
+ uploadFile(service, FILE_ID, tempFile);
+ }
+
+ private static Path downloadFile(Drive service, String fileId) throws IOException {
+ Path tempFile = Files.createTempFile("base", ".xml");
+ try (OutputStream outputStream = Files.newOutputStream(tempFile)) {
+ service.files().get(fileId).executeMediaAndDownloadTo(outputStream);
+ }
+ return tempFile;
+ }
+
+
+ private static void uploadFile(Drive service, String fileId, Path filePath) throws IOException {
+ File fileMetadata = new File();
+ java.io.File file = filePath.toFile();
+ com.google.api.client.http.FileContent mediaContent = new com.google.api.client.http.FileContent("application/xml", file);
+ service.files().update(fileId, fileMetadata, mediaContent).execute();
+ }
+}
diff --git a/src/outils/commandes.java b/src/outils/commandes.java
index cf2a30e..ddea8f6 100644
--- a/src/outils/commandes.java
+++ b/src/outils/commandes.java
@@ -11,8 +11,8 @@ import java.util.List;
public class commandes {
public static noeud nBase = null; // La base de données sous forme de noeud.
- public static String version = "1.0.6"; // La version actuelle
- public static String dateversion = "2 aout 2023"; // La version actuelle
+ public static String version = "1.0.7"; // La version actuelle
+ public static String dateversion = "29 aout 2024"; // La version actuelle
// Les colonnes obligatoires dû à l'inscription des étudaints.
// nom des colonnes après traitement des caractères (Accès à la base XML)
@@ -44,7 +44,7 @@ public class commandes {
// Version vérification
public static Boolean newVersion = false; //Permet de vérifier l'existance d'un nouvelle version.
- public static String nameNewVersion = "V0.0.0"; //Le nom de la nouvelle version qui s'affiche dans le bouton de la version disponible.
+ public static String nameNewVersion = "V1.0.7"; //Le nom de la nouvelle version qui s'affiche dans le bouton de la version disponible.
// Messages et sécurité
public static Boolean helpme1 = false; //M'aider à compléter mon service annuel.
@@ -71,13 +71,13 @@ public class commandes {
public static boolean enabled_Colonne_Option_5 = true;
// Nombre d'image d'acceuil
- public static int nombreImage = 41;
+ public static int nombreImage = 42;
// Nombre maximal de fichier dans l'archive
public static int nombreMaxSauvegardeArchive = 300;
// Nombre de minute entre deux sauvegardes dans l'archive
- public static int nombreMinuteEntreDeuxSauvegarde = 2 ;
+ public static int nombreMinuteEntreDeuxSauvegarde = 5 ;
}
diff --git a/src/outils/noeud.java b/src/outils/noeud.java
index 1ce751e..58b63b1 100644
--- a/src/outils/noeud.java
+++ b/src/outils/noeud.java
@@ -1172,7 +1172,12 @@ public class noeud implements Cloneable{
}
int e = attributes.hashCode();
- int f = content.hashCode();
+
+ int f = 0;
+ if(content!=null) {
+ f = content.hashCode();
+ }
+
int g = 0;
String hashG = "";
for(noeud child : children) {
diff --git a/src/resources/.gitignore b/src/resources/.gitignore
new file mode 100644
index 0000000..d077bc3
--- /dev/null
+++ b/src/resources/.gitignore
@@ -0,0 +1 @@
+/august-edge-427718-m0-6298e03aba4c.json
diff --git a/src/resources/Sans titre_42.jpg b/src/resources/Sans titre_42.jpg
new file mode 100644
index 0000000..2bb5a5d
Binary files /dev/null and b/src/resources/Sans titre_42.jpg differ