MAJ V4.5.0
This commit is contained in:
parent
b0663fb3e8
commit
c5cb159d7c
File diff suppressed because one or more lines are too long
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@ -179,3 +179,4 @@
|
||||
/evaltabstyleleader.png
|
||||
/evaltabstyleleader.svg
|
||||
/evaltabstyleleadermini.png
|
||||
/OnLineVersions/
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -34,10 +34,13 @@ public class commandes {
|
||||
public static node nodeCSV = null;
|
||||
|
||||
//** Version
|
||||
public static String version ="V4.5.0"; // La version actuelle
|
||||
public static String version ="V4.3.0"; // La version actuelle
|
||||
public static String versionEvaluation = "";
|
||||
public static String branch = "Origin";
|
||||
public static String Annee ="2024";
|
||||
public static boolean newVersion = false;
|
||||
public static String nameNewVersion = "V0.0.0"; //Le nom de la nouvelle version qui s'affiche dans le bouton de la version disponible.
|
||||
|
||||
|
||||
//***************************************************
|
||||
//** Les commandes par défaut à travers la console **
|
||||
|
116
src/OnLineVersions/verificationNewVersion.java
Normal file
116
src/OnLineVersions/verificationNewVersion.java
Normal file
@ -0,0 +1,116 @@
|
||||
package OnLineVersions;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
|
||||
import MEPTL.commandes;
|
||||
|
||||
|
||||
|
||||
public class verificationNewVersion {
|
||||
|
||||
|
||||
|
||||
public verificationNewVersion() {
|
||||
// String[] Version = commandes.version.split("\\.")
|
||||
// int versionIntegerApplication = Integer.valueOf( Version[0] + Version[1] + Version[2]);
|
||||
|
||||
try {
|
||||
URL url = new URL("https://forge.chapril.org/pablo/analyseWriter/releases");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
StringBuilder content = new StringBuilder();
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
content.append(line);
|
||||
}
|
||||
reader.close();
|
||||
|
||||
|
||||
// Motif de la sous-chaîne recherchée Vx.x.x
|
||||
String pattern = "V\\d+\\.\\d+\\.\\d+";
|
||||
|
||||
// Création du motif de recherche
|
||||
Pattern regex = Pattern.compile(pattern);
|
||||
|
||||
// Création du matcher pour l'entrée donnée
|
||||
Matcher matcher = regex.matcher(content);
|
||||
|
||||
//Version max
|
||||
int versionMax = 0;
|
||||
|
||||
// Parcours des correspondances
|
||||
while (matcher.find()) {
|
||||
// Récupération de la sous-chaîne correspondante
|
||||
String match = matcher.group();
|
||||
|
||||
// Conversion en nombre entier
|
||||
String numericString = match.replaceAll("[^\\d.]", "");
|
||||
|
||||
|
||||
versionMax = versionNombre(numericString);
|
||||
|
||||
if(versionMax>0) {
|
||||
System.out.println("La nouvelle version est disponible !");
|
||||
System.out.println(match);
|
||||
commandes.newVersion = true;
|
||||
commandes.nameNewVersion = match;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retour un entier qui correspond à la version.<br>
|
||||
* La première valeur est multipliée par 1 000 000.<br>
|
||||
* La seconde valeur est multipliée par 1 000.<br>
|
||||
* La troisième valeur n'est pas multipliée.<vr>
|
||||
*
|
||||
* @param versionForge
|
||||
* @return
|
||||
*/
|
||||
public static Integer versionNombre(String versionForge) {
|
||||
String[] VersionApplicationSplit = commandes.version.replaceAll("V", "").split("\\.");
|
||||
String[] VersionForgeSplit = versionForge.split("\\.");
|
||||
|
||||
boolean newVersion = false;
|
||||
|
||||
if( Integer.valueOf(VersionApplicationSplit[0]) < Integer.valueOf(VersionForgeSplit[0]) ) {
|
||||
newVersion=true;
|
||||
}else if ((Integer.valueOf(VersionApplicationSplit[0])==Integer.valueOf(VersionForgeSplit[0]))
|
||||
&& (Integer.valueOf(VersionApplicationSplit[1]) < Integer.valueOf(VersionForgeSplit[1]))) {
|
||||
newVersion=true;
|
||||
}else if ((Integer.valueOf(VersionApplicationSplit[0])==Integer.valueOf(VersionForgeSplit[0]))
|
||||
&& (Integer.valueOf(VersionApplicationSplit[1]) == Integer.valueOf(VersionForgeSplit[1]))
|
||||
&& (Integer.valueOf(VersionApplicationSplit[2])<Integer.valueOf(VersionForgeSplit[2])) ){
|
||||
newVersion=true;
|
||||
}
|
||||
|
||||
if(newVersion) {
|
||||
return Integer.valueOf(VersionForgeSplit[0])*1000000 + Integer.valueOf(VersionForgeSplit[1])*1000 + Integer.valueOf(VersionForgeSplit[2]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import MEPTL.commandes;
|
||||
import OnLineVersions.verificationNewVersion;
|
||||
import baseEvaluations.recupeNodeBaseEvaluations;
|
||||
|
||||
public class mainApp extends JFrame implements ActionListener{
|
||||
@ -49,6 +50,8 @@ public class mainApp extends JFrame implements ActionListener{
|
||||
*/
|
||||
private void initialize() {
|
||||
|
||||
new verificationNewVersion();
|
||||
|
||||
frmEvalwriter = new JFrame();
|
||||
frmEvalwriter.setResizable(false);
|
||||
frmEvalwriter.setBounds(100, 100, 500, 380);
|
||||
@ -56,6 +59,7 @@ public class mainApp extends JFrame implements ActionListener{
|
||||
int screenHeight = (int) java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight();
|
||||
frmEvalwriter.setLocation(( (screenWidth) - frmEvalwriter.getWidth()) / 2, (screenHeight - frmEvalwriter.getHeight()) / 2);
|
||||
|
||||
|
||||
frmEvalwriter.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frmEvalwriter.getContentPane().setLayout(null);
|
||||
ImageIcon img = new ImageIcon(getClass().getResource("/evalwriter.png") );
|
||||
@ -80,6 +84,10 @@ public class mainApp extends JFrame implements ActionListener{
|
||||
|
||||
JLabel lblNewLabel = new JLabel();
|
||||
ImageIcon img2 = new ImageIcon(getClass().getResource("/accueil.png") );
|
||||
if(commandes.newVersion) {
|
||||
img2 = new ImageIcon(getClass().getResource("/resources/accueil_new_version.png") );
|
||||
}
|
||||
|
||||
lblNewLabel.setIcon(img2);
|
||||
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblNewLabel.setFont(new Font("Pacifico", Font.PLAIN, 26));
|
||||
@ -142,55 +150,6 @@ public class mainApp extends JFrame implements ActionListener{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// private void recupeNodeBaseEvaluations() {
|
||||
//
|
||||
//// File directory = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
|
||||
//
|
||||
// String directoryName = "";
|
||||
// File file = null;
|
||||
// if(commandes.PathBaseEvaluationDefaut) {
|
||||
// directoryName = Paths.get("").toAbsolutePath().toString();
|
||||
// }else {
|
||||
// directoryName = commandes.PathBaseEvaluations;
|
||||
// }
|
||||
//
|
||||
// if(commandes.os.contains("Win")) {
|
||||
// file = new File(directoryName + "\\" + commandes.NameBaseEvaluations);
|
||||
// }else {
|
||||
// file = new File(directoryName + "/" + commandes.NameBaseEvaluations);
|
||||
// }
|
||||
//
|
||||
// if(file!=null) {
|
||||
// BufferedReader br;
|
||||
// try {
|
||||
// br = new BufferedReader(
|
||||
// new InputStreamReader(
|
||||
// new FileInputStream(file.getAbsoluteFile()), "UTF-8"));
|
||||
// String line;
|
||||
// StringBuilder targetString = new StringBuilder();
|
||||
// while ((line = br.readLine()) != null) {
|
||||
// targetString.append(line);
|
||||
// }
|
||||
// node evaluations = new node(targetString.toString().replace("\t","").replace("\r", "").replace("\n", ""));
|
||||
// if(evaluations!=null) {
|
||||
// if(evaluations.getNodes().size()>0) {
|
||||
// if(evaluations.getNomElt().equals("evaluations")) {
|
||||
// commandes.evaluationsBase = evaluations;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }catch (Exception e) {
|
||||
// JFrame frame = new JFrame();
|
||||
// JLabel texte = new JLabel("<html><p>La base de données ne se trouve pas dans le même dossier que celui de l'application.</p><br>"
|
||||
// +"<p>Vous pouvez charger la base de données depuis le menu \"<b>Fichier</b>\" de l'application.</p>"
|
||||
// + "<p>Sinon, une nouvelle base de données sera créé dans le dossier de l'application.</p></html>");
|
||||
// JOptionPane.showMessageDialog(frame, texte);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
BIN
src/resources/accueil_new_version.png
Normal file
BIN
src/resources/accueil_new_version.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
449
src/resources/accueill new version.svg
Normal file
449
src/resources/accueill new version.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 54 KiB |
Loading…
Reference in New Issue
Block a user