444 lines
25 KiB
Java
444 lines
25 KiB
Java
package outils;
|
|
|
|
import java.io.IOException;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
import nodeAC.Attributs;
|
|
import nodeAC.Ecriture;
|
|
import nodeAC.hashNodeAC;
|
|
import nodeAC.nodeAC;
|
|
|
|
/**
|
|
*
|
|
* @author pablo rodriguez
|
|
*
|
|
* Vérification du fichier d'analyse.
|
|
*
|
|
*/
|
|
public class verificationFichierAnalyse {
|
|
|
|
public static boolean erreur = false;
|
|
public static StringBuilder messageErreur = new StringBuilder();
|
|
static nodeAC verifSujet = new nodeAC();
|
|
|
|
public verificationFichierAnalyse() throws CloneNotSupportedException{
|
|
|
|
if(calc.commandes.sujet==null) {
|
|
calc.commandes.fichierAnalyseValide=false;
|
|
JOptionPane.showMessageDialog(null, "<html><h1 style=\"text-align:center;\">Ce fichier d'analyse est null.</h1>", "Erreur", JOptionPane.ERROR_MESSAGE );
|
|
}
|
|
|
|
if(calc.commandes.fichierAnalyseValide) if(!calc.commandes.sujet.getNomElt().equals("classeur")) {
|
|
calc.commandes.fichierAnalyseValide=false;
|
|
JOptionPane.showMessageDialog(null, "<html><h1 style=\"text-align:center;\">Ce fichier n'est pas un fichier<br>d'analyseCalc</h1></html>", "Erreur", JOptionPane.ERROR_MESSAGE );
|
|
}
|
|
|
|
//** Vérification des attributs du node fichier
|
|
if(calc.commandes.fichierAnalyseValide) if(calc.commandes.sujet.getAttributs().size()<=0) {
|
|
calc.commandes.fichierAnalyseValide=false;
|
|
JOptionPane.showMessageDialog(null, "<html><h1 style=\"text-align:center;\">Le premier node du classeur n'a pas d'attribut.</h1>", "Erreur", JOptionPane.ERROR_MESSAGE );
|
|
}else {
|
|
if(calc.commandes.fichierAnalyseValide)verificationNodeFichier(calc.commandes.sujet.getAttributs());
|
|
}
|
|
|
|
//** verification du setting
|
|
if(calc.commandes.fichierAnalyseValide) if(calc.commandes.sujet.containChildByName("settings")) {
|
|
verificationNodeSetting(calc.commandes.sujet.retourneFirstEnfantsByName("settings"));
|
|
}
|
|
|
|
//** Verification du hash et du nom du fichier d'analyse
|
|
if(calc.commandes.fichierAnalyseValide) {
|
|
new hashNodeAC();
|
|
|
|
calc.commandes.hash = String.valueOf( hashNodeAC.HashNode(calc.commandes.sujet,0));
|
|
if(calc.commandes.sujet.getAttributs().get("analysis_filename")!=null) {
|
|
if(!calc.commandes.sujet.getAttributs().get("analysis_filename").equals(calc.commandes.nameSujet)) {
|
|
calc.commandes.MAJnameAnalysisFile=true;
|
|
}
|
|
}
|
|
if(calc.commandes.sujet.getAttributs().get("hash")==null) {
|
|
calc.commandes.MAJFichierAnalyse =true;
|
|
}else {
|
|
if(!calc.commandes.sujet.getAttributs().get("hash").equals(calc.commandes.hash)) {
|
|
calc.commandes.MAJFichierAnalyse=true;
|
|
}
|
|
}
|
|
if(calc.commandes.MAJFichierAnalyse||calc.commandes.MAJnameAnalysisFile) {
|
|
messagMiseAJourFichierAnalyse(calc.commandes.hash);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Vérification des attributs du node classeur.
|
|
* @param attributs
|
|
*/
|
|
private static void verificationNodeFichier(Attributs attributs) {
|
|
|
|
|
|
if(attributs.get("metaSujet")==null) {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la metaSujet.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
if(attributs.get("metaSujet")!=null)if(attributs.get("metaSujet").isEmpty() ) {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la valeur de metaSujet.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("progression")!=null) {
|
|
String p = attributs.get("progression");
|
|
try {
|
|
Double.valueOf(p);
|
|
} catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur du coef. de progression.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque le coef. de progression.<br>Par défaut la valeur est de 1.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("bareme")!=null) {
|
|
String p = attributs.get("bareme");
|
|
try {
|
|
Double.valueOf(p);
|
|
} catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur du bareme.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable bareme.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
|
|
if(attributs.get("baremeABC")!=null) {
|
|
String p = attributs.get("baremeABC");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable baremeABC.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable baremeABC.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("controleDateCreation")!=null) {
|
|
String p = attributs.get("controleDateCreation");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable controle de la date de création.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable controle de la date de création.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("presenceMetaSujet")!=null) {
|
|
String p = attributs.get("presenceMetaSujet");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable présence de la metaSujet.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable présence de la metaSujet.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("controle_Initial_Creator")!=null) {
|
|
String p = attributs.get("controle_Initial_Creator");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable contrôle de l'auteur initial (créateur).<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable contrôle de l'auteur initial (créateur).<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("analyse_exclure_name_creator")!=null) {
|
|
String p = attributs.get("analyse_exclure_name_creator");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable analyse_exclure_name_creator.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable analyse_exclure_name_creator.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
if(attributs.get("historiquePresent")!=null) {
|
|
String p = attributs.get("historiquePresent");
|
|
if(!(p.equals("true")||p.equals("false"))) {
|
|
JOptionPane.showMessageDialog(null, "<html>Problème avec la valeur de la variable présence de l'historique.<br>Veuillez la modifier dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque la variable présence de l'historique.<br>Veuillez l'ajouter dans les propriétés du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Evaluation du nodeAC setting
|
|
* @param attribut
|
|
* @param nameNode
|
|
*/
|
|
private static void verificationNodeSetting(nodeAC setting) {
|
|
|
|
if(setting.getAttributs().get("culture") != null) {
|
|
if(!setting.getAttributs().get("culture").equals("FR")) {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque le node <culture>.<br>Veuillez ajouter le node <setting> en cliquant sur le bouton paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}
|
|
|
|
|
|
if(setting.containChildByName("csv")) {
|
|
nodeAC csv = setting.retourneFirstEnfantsByName("csv");
|
|
if(csv.getAttributs().get("encoding") != null) {
|
|
if(!csv.getAttributs().get("encoding").equals("UTF-8") && !csv.getAttributs().get("encoding").equals("US-ASCII") && !csv.getAttributs().get("encoding").equals("ISO-8859-1")
|
|
&& !csv.getAttributs().get("encoding").equals("UTF-16BE") && !csv.getAttributs().get("encoding").equals("UTF-16LE") && !csv.getAttributs().get("encoding").equals("UTF-16")) {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque dans le node <csv> la valeur de l'attributs \"encoding\".<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque dans le node <csv> l'attributs \"encoding\".<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
}else {
|
|
JOptionPane.showMessageDialog(null, "<html>Il manque dans le node <csv> dans les paramétres du fichier d'analyse.<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
|
|
if(setting.containChildByName("zip")) {
|
|
nodeAC zip = setting.retourneFirstEnfantsByName("zip");
|
|
if(zip.getAttributs().get("size") != null) {
|
|
Long size = (long) 0;
|
|
try {
|
|
size = Long.valueOf(zip.getAttributs().get("size"));
|
|
}catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <zip>, la valeur de l'attribut \"size\" doit être une valeur numérique entière."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
verifSujet.getAttributs().put("erreurTailleSize","true");
|
|
}
|
|
if(size<1000000) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <zip>, la valeur de l'attribut \"size\" est trop faible."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
verifSujet.getAttributs().put("erreurTailleSize","true");
|
|
}
|
|
if(size>100000000) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <zip>, la valeur de l'attribut \"size\" est trop grande."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
verifSujet.getAttributs().put("erreurTailleSize","true");
|
|
}
|
|
}
|
|
|
|
if(zip.getAttributs().get("name") != null) {
|
|
String name = zip.getAttributs().get("name");
|
|
Pattern pt = Pattern.compile("[^a-zA-Z0-9]"); // avec les chiffres "[^a-zA-Z0-9]"
|
|
Matcher match= pt.matcher(name);
|
|
if(match.find()) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <zip>, la valeur de l'attribut \"name\" ne doit pas contenir de caractères spéciaux."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
verifSujet.getAttributs().put("erreurNameArchive","true");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if(setting.containChildByName("plagiarism")) {
|
|
nodeAC plagiarism = setting.retourneFirstEnfantsByName("plagiarism");
|
|
if(plagiarism.getAttributs().get("number_match") != null) {
|
|
int number_match = -1;
|
|
try {
|
|
number_match = Integer.valueOf(plagiarism.getAttributs().get("number_match"));
|
|
}catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre de correspondance \"number_match\" doit être une valeur numérique entière."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
if(number_match<0) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre de correspondance \"number_match\" doit être une valeur numérique entière POSITIVE."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
}
|
|
if(plagiarism.getAttributs().get("mini_number_modification") != null) {
|
|
int mini_number_modification = -1;
|
|
try {
|
|
mini_number_modification = Integer.valueOf(plagiarism.getAttributs().get("mini_number_modification"));
|
|
}catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre minimum de modification \"mini_number_modification\" doit être une valeur numérique entière."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
if(mini_number_modification<-1) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre minimum de modification \"mini_number_modification\" doit être une valeur numérique entière supérieureou égale à -1."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
}
|
|
if(plagiarism.getAttributs().get("nombres_modifications_simultané_maxi") != null) {
|
|
int nombres_modifications_simultané_maxi = -1;
|
|
try {
|
|
nombres_modifications_simultané_maxi = Integer.valueOf(plagiarism.getAttributs().get("nombres_modifications_simultané_maxi"));
|
|
}catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre des modifications simultanées \"nombres_modifications_simultané_maxi\" doit être une valeur numérique entière."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
if(nombres_modifications_simultané_maxi<0) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <plagiarism>, la valeur de l'attribut nombre des modifications simultanées \"nombres_modifications_simultané_maxi\" doit être une valeur numérique entière POSITIVE."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(setting.containChildByName("text:similarity")) {
|
|
nodeAC similarity = setting.retourneFirstEnfantsByName("text:similarity");
|
|
if(similarity.getAttributs().get("tolerance_text")!=null) {
|
|
double tolerance_text = 0.0;
|
|
try {
|
|
tolerance_text = Double.valueOf(similarity.getAttributs().get("tolerance_text"));
|
|
}catch (Exception e) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <text:similarity>, la valeur de l'attribut de la distance de Levenshtein \"tolerance_text\" doit être une valeur numérique décimale comprise entre 0 et 1."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
if(tolerance_text<0 || tolerance_text>1) {
|
|
JOptionPane.showMessageDialog(null, "<html>Erreur dans le node <text:similarity>, la valeur de l'attribut de la distance de Levenshtein \"tolerance_text\" doit être une valeur numérique décimale comprise entre 0 et 1."
|
|
+ "<br>Veuillez l'ajouter dans les paramétres du fichier d'analyse.</html>", "Avertissement", JOptionPane.WARNING_MESSAGE);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Mise à jour du hash et du nom du fichier d'analyse.</br>
|
|
* @throws CloneNotSupportedException
|
|
* @throws IOException
|
|
*/
|
|
public void MiseAJourFichierAnalyse() throws CloneNotSupportedException, IOException {
|
|
|
|
new hashNodeAC();
|
|
calc.commandes.hash = String.valueOf( hashNodeAC.HashNode(calc.commandes.sujet, 0));
|
|
|
|
boolean maj =false;
|
|
if(calc.commandes.sujet.getAttributs().get("hash")==null) {
|
|
maj=true;
|
|
}else {
|
|
if(!calc.commandes.sujet.getAttributs().get("hash").equals(calc.commandes.hash)) {
|
|
maj=true;
|
|
}
|
|
}
|
|
if(calc.commandes.sujet.getAttributs().get("analysis_filename")==null) {
|
|
maj=true;
|
|
}else {
|
|
if(!calc.commandes.sujet.getAttributs().get("analysis_filename").equals(calc.commandes.analysis_filename)) {
|
|
maj=true;
|
|
}
|
|
}
|
|
if(maj) {
|
|
int nbespace = "───────────────────────────┐".length()-calc.commandes.hash.length();
|
|
if (nbespace<0) nbespace=1;
|
|
int nbespace2 = "───────────────────────────────┐".length()-calc.commandes.analysis_filename.length();
|
|
if (nbespace2<0) nbespace2=1;
|
|
System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐");
|
|
System.out.println("\t\t│ Le hash du code de l'évaluation ou le nom du fichier d'analyse │");
|
|
System.out.println("\t\t│ a été mise à jour dans le fichier d'analyse. │");
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + calc.commandes.hash + new String(new char[nbespace]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + calc.commandes.analysis_filename + new String(new char[nbespace2]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
|
|
System.out.println();
|
|
calc.commandes.sujet.getAttributs().put("hash", calc.commandes.hash);
|
|
calc.commandes.sujet.getAttributs().put("analysis_filename", calc.commandes.nameSujet);
|
|
|
|
calc.commandes.message.append("<hr><h1>Le hash du code de l'évaluation ou le nom du fichier d'analyse</h1><hr>");
|
|
calc.commandes.message.append("<p> a été mise à jour dans le fichier d'analyse.</p>");
|
|
calc.commandes.message.append("<br>");
|
|
calc.commandes.message.append("<p> Le hash du code de l'évaluation est : " + calc.commandes.hash +"</p>");
|
|
calc.commandes.message.append("<p> Le nom du fichier d'analyse est : " + calc.commandes.analysis_filename + "</p>");
|
|
calc.commandes.message.append("<hr>");
|
|
calc.commandes.message.append("<br>");
|
|
|
|
String cheminVersFichierAnalyse = calc.commandes.PathFilenameAnalysis;
|
|
if(calc.commandes.analysis_filename.contains(".")) {
|
|
Ecriture.ecritureNodeEnXML(calc.commandes.sujet,calc.commandes.analysis_filename.substring(0, calc.commandes.nameSujet.lastIndexOf(".")),cheminVersFichierAnalyse,Ecriture.typeFichier.fichier_analyse);
|
|
}else {
|
|
Ecriture.ecritureNodeEnXML(calc.commandes.sujet,calc.commandes.analysis_filename,cheminVersFichierAnalyse,Ecriture.typeFichier.fichier_analyse);
|
|
}
|
|
|
|
}else {
|
|
System.out.println("\t\t┌─────────────────────────────────────────────────────┐");
|
|
System.out.println("\t\t│ Vérification du hash et du nom du fichier correct. │");
|
|
System.out.println("\t\t└─────────────────────────────────────────────────────┘");
|
|
System.out.println();
|
|
calc.commandes.message.append("<p>**********************************************************</p>");
|
|
calc.commandes.message.append("<p> Vérification du hash et du nom du fichier correct.</p>");
|
|
calc.commandes.message.append("<p>**********************************************************</p>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
*
|
|
* @param nomFichier
|
|
* @throws CloneNotSupportedException
|
|
* @throws IOException
|
|
*/
|
|
public static void MiseAJourHashNomFichierAnalyse(String nomFichier) throws CloneNotSupportedException, IOException {
|
|
if(!nomFichier.contains(".xml")) nomFichier= nomFichier+".xml";
|
|
|
|
calc.commandes.hash = String.valueOf(hashNodeAC.HashNode(calc.commandes.sujet,0));
|
|
calc.commandes.sujet.getAttributs().put("hash",String.valueOf(calc.commandes.hash));
|
|
|
|
calc.commandes.analysis_filename = nomFichier;
|
|
calc.commandes.sujet.getAttributs().put("analysis_filename",nomFichier);
|
|
|
|
}
|
|
|
|
|
|
|
|
static private void messagMiseAJourFichierAnalyse(String hash) {
|
|
int nbespace = "───────────────────────────┐".length()-hash.length();
|
|
if (nbespace<0) nbespace=1;
|
|
int nbespace2 = "───────────────────────────────┐".length()-calc.commandes.nameSujet.length();
|
|
if (nbespace2<0) nbespace2=1;
|
|
System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐");
|
|
System.out.println("\t\t│ A la fin de l'évaluation. │");
|
|
System.out.println("\t\t│ Il y aura une mise à jour du fichier d'analyse. │");
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + hash + new String(new char[nbespace]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + calc.commandes.nameSujet + new String(new char[nbespace2]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
|
|
System.out.println();
|
|
}
|
|
|
|
static public void messagMiseAJourFichierAnalyseAprèsAnalyse() {
|
|
int nbespace = "───────────────────────────┐".length()-calc.commandes.hash.length();
|
|
if (nbespace<0) nbespace=1;
|
|
int nbespace2 = "───────────────────────────────┐".length()-calc.commandes.hash.length();
|
|
if (nbespace2<0) nbespace2=1;
|
|
System.out.println("\t\t┌────────────────────────────────────────────────────────────────────┐");
|
|
System.out.println("\t\t│ Mise à jour du fichier d'analyse │");
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t│ Le hash du code de l'évaluation est : " + calc.commandes.hash + new String(new char[nbespace]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ Le nom du fichier d'analyse est : " + calc.commandes.nameSujet + new String(new char[nbespace2]).replace("\0", " ") +"│" );
|
|
System.out.println("\t\t│ │");
|
|
System.out.println("\t\t└────────────────────────────────────────────────────────────────────┘");
|
|
System.out.println();
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|