diff --git a/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/comparison/moduleim/impl/CompareImageModuleImpl.java b/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/comparison/moduleim/impl/CompareImageModuleImpl.java index fc3d40e..c78c7a2 100644 --- a/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/comparison/moduleim/impl/CompareImageModuleImpl.java +++ b/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/comparison/moduleim/impl/CompareImageModuleImpl.java @@ -77,22 +77,26 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile return false; } - if ( imToleranceTxt.equalsIgnoreCase( "N" ) ) { + if ( imToleranceTxt.contains( "N" ) || imToleranceTxt.contains( "n" ) ) { // null = 0% imTolerance = "0%"; percentageInvalid = (float) 100.000000000; - } else if ( imToleranceTxt.equalsIgnoreCase( "S" ) ) { + imToleranceTxt = "N"; + } else if ( imToleranceTxt.contains( "S" ) || imToleranceTxt.contains( "s" ) ) { // small = 2% imTolerance = "2%"; percentageInvalid = (float) 99.9999; - } else if ( imToleranceTxt.equalsIgnoreCase( "L" ) ) { + imToleranceTxt = "S"; + } else if ( imToleranceTxt.contains( "L" ) || imToleranceTxt.contains( "L" ) ) { // large = 10% imTolerance = "10%"; percentageInvalid = (float) 99.99; - } else if ( imToleranceTxt.equalsIgnoreCase( "XL" ) ) { + imToleranceTxt = "L"; + } else if ( imToleranceTxt.contains( "XL" ) || imToleranceTxt.contains( "xl" ) ) { // xlarge = 15% imTolerance = "15%"; percentageInvalid = (float) 99.9; + imToleranceTxt = "XL"; } else { // medium = 5% imTolerance = "5%"; @@ -118,10 +122,10 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile /* compare -fuzz 15% -metric AE -quiet -identify -verbose -highlight-color DarkRed Image_1.jpg * Image_2.jpg mask.jpg >>results_id.txt 2>results.txt */ - String command = "cmd /c \"" + pathToCompareExe + " -fuzz " + imTolerance + String command = "cmd /c \"\"" + pathToCompareExe + "\" -fuzz " + imTolerance + " -metric AE -quiet -identify -verbose -highlight-color DarkRed \"" - + origDatei.getAbsolutePath() + "\" " + "\"" + repDatei.getAbsolutePath() + "\" \"" - + pathToMask + "\" >>" + pathToOutputId + " 2>" + pathToOutput + "\""; + + origDatei.getAbsolutePath() + "\" \"" + repDatei.getAbsolutePath() + "\" \"" + + pathToMask + "\" >>\"" + pathToOutputId + "\" 2>\"" + pathToOutput + "\""; /* Das redirect Zeichen verunmöglicht eine direkte eingabe. mit dem geschachtellten Befehl * gehts: cmd /c\"urspruenlicher Befehl\" */ @@ -158,6 +162,28 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile proc.waitFor(); Util.switchOnConsole(); + // Kontrolle ob die Reports existieren + if ( !report.exists() ) { + getMessageService().logError( + getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) + + getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT, + report.getAbsolutePath() ) ); + if ( !reportId.exists() ) { + getMessageService().logError( + getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) + + getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT, + reportId.getAbsolutePath() ) ); + return false; + } + return false; + } + if ( !reportId.exists() ) { + getMessageService().logError( + getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) + + getTextResourceService().getText( ERROR_XML_IMCMP_NOREPORT, + reportId.getAbsolutePath() ) ); + return false; + } } catch ( Exception e ) { getMessageService() .logError( @@ -202,6 +228,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile BufferedReader in = new BufferedReader( new FileReader( report ) ); String line; boolean allNull = false; + boolean allExist = false; while ( (line = in.readLine()) != null ) { @@ -221,6 +248,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile if ( line.contains( " all: 0" ) ) { allNull = true; } else { + allExist = true; /* Invalide Px extrahieren " all: 3563" extrahieren */ String lineReportAll = line.substring( 9 ); try { @@ -238,10 +266,17 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile } } in.close(); + if ( !allExist ) { + getMessageService().logError( + getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) + + getTextResourceService().getText( ERROR_XML_IMCMP_NOALL ) ); + return false; + } } catch ( Exception e ) { getMessageService().logError( getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) - + getTextResourceService().getText( ERROR_XML_UNKNOWN, e.getMessage() ) ); + + getTextResourceService() + .getText( ERROR_XML_UNKNOWN, "compare: " + e.getMessage() ) ); return false; } } catch ( Exception e ) { @@ -289,7 +324,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile } } - // TODO: Marker: Auwertung und Fehlerausgabe wenn nicht bestanden. + // TODO: Marker: Auswertung und Fehlerausgabe wenn nicht bestanden. } if ( !imgPx1.equals( imgPx2 ) ) { // die beiden Bilder haben nicht gleich viel Pixels @@ -309,18 +344,16 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile // Bildvergleich nicht bestanden if ( allNoInt ) { /* Bilder mit vielen Pixels die Abweichen (Potenz -> String): Vereinfachte Fehlerausgabe */ - double z2 = 0; /* Invalide [allStr] und total px z2 aus imgPx1 " Pixels: 8809392" extrahieren */ String lineReport = imgPx1.substring( 12 ); // lineReport = 8809392 - z2 = Double.parseDouble( lineReport ); isValid = false; getMessageService().logError( getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) - + getTextResourceService().getText( ERROR_XML_CI_CIINVALIDSTR, z2, + + getTextResourceService().getText( ERROR_XML_CI_CIINVALIDSTR, lineReport, imToleranceTxt, allStr ) ); } else { @@ -340,7 +373,7 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile percentageCalc = (float) (100 - (100 / z2 * z1)); percentageCalcInv = 100 - percentageCalc; - // Prozetzahlen vergleichen + // Prozentzahlen vergleichen if ( percentageInvalid > percentageCalc ) { // Bilder mit einer grösseren Abweichung isValid = false; @@ -354,9 +387,11 @@ public boolean validate( File origDatei, File repDatei, File directoryOfLogfile } in.close(); } catch ( Exception e ) { - getMessageService().logError( - getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) - + getTextResourceService().getText( ERROR_XML_UNKNOWN, e.getMessage() ) ); + getMessageService() + .logError( + getTextResourceService().getText( MESSAGE_XML_MODUL_CI ) + + getTextResourceService().getText( ERROR_XML_UNKNOWN, + "identify: " + e.getMessage() ) ); return false; } // reports löschen diff --git a/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/logging/MessageConstants.java b/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/logging/MessageConstants.java index f7d5e13..3a78304 100644 --- a/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/logging/MessageConstants.java +++ b/KOST-Simy/src/main/java/ch/kostceco/tools/kostsimy/logging/MessageConstants.java @@ -85,6 +85,7 @@ public interface MessageConstants String ERROR_XML_IMCMP_MISSING = "error.xml.imcmp.missing"; String ERROR_XML_IMCMP_SERVICEFAILED = "error.xml.imcmp.servicefailed"; String ERROR_XML_IMCMP_NOREPORT = "error.xml.imcmp.noreport"; + String ERROR_XML_IMCMP_NOALL = "error.xml.imcmp.noall"; String ERROR_XML_CI_CIINVALID = "error.xml.ci.ciinvalid"; String ERROR_XML_CI_CIINVALIDSTR = "error.xml.ci.ciinvalidstr"; String ERROR_XML_CI_SIZEINVALID = "error.xml.ci.sizeinvalid"; diff --git a/KOST-Simy/src/main/resources/de_messages.properties b/KOST-Simy/src/main/resources/de_messages.properties index 0c5f7bb..89b825d 100644 --- a/KOST-Simy/src/main/resources/de_messages.properties +++ b/KOST-Simy/src/main/resources/de_messages.properties @@ -26,7 +26,7 @@ message.xml.header = {0} message.xml.end = message.xml.formaton = {0} -message.xml.info = KOST-Simy v0.0.4, Copyright (C) 2015 Claire Roethlisberger (KOST-CECO). This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see GPL-3.0_COPYING.txt for details +message.xml.info = KOST-Simy v0.0.5, Copyright (C) 2015 Claire Roethlisberger (KOST-CECO). This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see GPL-3.0_COPYING.txt for details message.xml.valergebnis = message.comparison = Bildvergleich message.compfiles = {0} - {1} @@ -63,8 +63,9 @@ error.xml.pdfa.ccitt = In der PDF-Datei sind {0} CCITT enthalten. Unter # Modul CI error.xml.imcmp.missing = Compare.exe von ImageMagick existiert nicht in den Ressourcen. Bitte Originalressourcen nicht veraendern. -> Bildvergleich abgebrochen! -error.xml.imcmp.servicefailed = Bei der Verwendung von ImageMagickCompare ist eine unbekannter Fehler aufgetreten. -> Fehler: {0} -> Bildvergleich abgebrochen! +error.xml.imcmp.servicefailed = Bei der Verwendung von ImageMagickCompare ist ein unbekannter Fehler aufgetreten. -> Fehler: {0} -> Bildvergleich abgebrochen! error.xml.imcmp.noreport = Das System kann {0} nicht finden! -> Bildvergleich abgebrochen! +error.xml.imcmp.noall = Bei der Verwendung von ImageMagickCompare ist ein Fehler aufgetreten. -> Fehler: Das Compare-Resultat wurde nicht ausgegeben. -> Ursache: Ueberpruefen Sie, dass kein Leerschlag im KOST-Simy-Pfad ist. -> Bildvergleich abgebrochen! error.xml.ci.ciinvalid = Der ImageMagickCompare-Vergleich wurde nicht bestanden. -> {0}% ({3}px von {1}px) unterscheiden sich. -> Konfigurierte Toleranz: {2}. error.xml.ci.ciinvalidstr = Der ImageMagickCompare-Vergleich wurde nicht bestanden. -> {2}px von {0}px unterscheiden sich. -> Konfigurierte Toleranz: {1}. error.xml.ci.sizeinvalid = Die Beiden Bilder sind nicht gleich gross: -> Original {0} - Replica {1}. -> Bildvergleich abgebrochen! diff --git a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_de.nsi b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_de.nsi index 4ff0183..cee8a76 100644 --- a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_de.nsi +++ b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_de.nsi @@ -1,5 +1,5 @@ ; The name of the installer -Name "KOST-Simy v0.0.4" +Name "KOST-Simy v0.0.5" ; Sets the icon of the installer Icon "simy.ico" ; remove the text 'Nullsoft Install System vX.XX' from the installer window diff --git a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_en.nsi b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_en.nsi index e7f626f..a84dbda 100644 --- a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_en.nsi +++ b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_en.nsi @@ -1,5 +1,5 @@ ; The name of the installer -Name "KOST-Simy v0.0.4" +Name "KOST-Simy v0.0.5" ; Sets the icon of the installer Icon "simy.ico" ; remove the text 'Nullsoft Install System vX.XX' from the installer window diff --git a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_fr.nsi b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_fr.nsi index 5993a4e..668732e 100644 --- a/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_fr.nsi +++ b/KOST-Simy/src/main/resources_notJar/GUI/KOSTsimy_fr.nsi @@ -1,5 +1,5 @@ ; The name of the installer -Name "KOST-Simy v0.0.4" +Name "KOST-Simy v0.0.5" ; Sets the icon of the installer Icon "simy.ico" ; remove the text 'Nullsoft Install System vX.XX' from the installer window diff --git a/KOST-Simy/src/main/resources_notJar/KOST-Simy_de.exe b/KOST-Simy/src/main/resources_notJar/KOST-Simy_de.exe index 0ea0a94..03b2dd2 100644 Binary files a/KOST-Simy/src/main/resources_notJar/KOST-Simy_de.exe and b/KOST-Simy/src/main/resources_notJar/KOST-Simy_de.exe differ diff --git a/KOST-Simy/src/main/resources_notJar/KOST-Simy_en.exe b/KOST-Simy/src/main/resources_notJar/KOST-Simy_en.exe index b25fde4..243ef4a 100644 Binary files a/KOST-Simy/src/main/resources_notJar/KOST-Simy_en.exe and b/KOST-Simy/src/main/resources_notJar/KOST-Simy_en.exe differ diff --git a/KOST-Simy/src/main/resources_notJar/KOST-Simy_fr.exe b/KOST-Simy/src/main/resources_notJar/KOST-Simy_fr.exe index b565493..eb2eb68 100644 Binary files a/KOST-Simy/src/main/resources_notJar/KOST-Simy_fr.exe and b/KOST-Simy/src/main/resources_notJar/KOST-Simy_fr.exe differ diff --git a/KOST-Simy/src/main/resources_notJar/configuration/kostsimy.conf.xml b/KOST-Simy/src/main/resources_notJar/configuration/kostsimy.conf.xml index 49592e5..386c4f0 100644 --- a/KOST-Simy/src/main/resources_notJar/configuration/kostsimy.conf.xml +++ b/KOST-Simy/src/main/resources_notJar/configuration/kostsimy.conf.xml @@ -4,6 +4,11 @@ temp_KOST-Simy 50 - + M