mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
7.72
FileMerger fix File Splitter SHA1
This commit is contained in:
parent
238bce81f1
commit
5eee0a2c69
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>7.71</version>
|
||||
<version>7.72</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -132,17 +132,17 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
|
||||
if (Files.exists(Paths.get(_file_name_full + ".sha1"))) {
|
||||
|
||||
String sha1 = Files.readString(Paths.get(_file_name_full + ".sha1")).trim();
|
||||
String sha1 = Files.readString(Paths.get(_file_name_full + ".sha1")).toLowerCase().trim();
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
merge_button.setText("CHECKING FILE INTEGRITY, please wait...");
|
||||
merge_button.setText(LabelTranslatorSingleton.getInstance().translate("CHECKING FILE INTEGRITY, please wait..."));
|
||||
});
|
||||
|
||||
if (sha1.equals(MiscTools.computeFileSHA1(new File(_file_name_full)))) {
|
||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("FILE INTEGRITY OK"));
|
||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("FILE INTEGRITY IS OK"));
|
||||
return true;
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("FILE SEEMS TO BE CORRUPTED"), "VERIFICATION ERROR", JOptionPane.ERROR_MESSAGE);
|
||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("FILE INTEGRITY CHECK FAILED"), "ERROR", JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -152,9 +152,15 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
|
||||
private void _deleteParts() {
|
||||
|
||||
this._file_parts.stream().map((file_path) -> new File(file_path)).forEachOrdered((file) -> {
|
||||
file.delete();
|
||||
});
|
||||
try {
|
||||
this._file_parts.stream().map((file_path) -> new File(file_path)).forEachOrdered((file) -> {
|
||||
file.delete();
|
||||
});
|
||||
|
||||
Files.deleteIfExists(Paths.get(_file_name_full + ".sha1"));
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(FileMergerDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
private final MainPanel _main_panel;
|
||||
private File[] _files = null;
|
||||
private File _output_dir = null;
|
||||
private volatile String _sha1=null;
|
||||
private volatile String _sha1 = null;
|
||||
private volatile long _progress = 0L;
|
||||
private volatile Path _current_part = null;
|
||||
private volatile int _current_file = 0;
|
||||
@ -85,17 +85,17 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
private boolean _splitFile(int i) throws IOException {
|
||||
|
||||
|
||||
_sha1 = "";
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
|
||||
try {
|
||||
_sha1 = MiscTools.computeFileSHA1(new File(_files[i].getAbsolutePath()));
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(FileSplitterDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this._progress = 0L;
|
||||
|
||||
@ -134,19 +134,19 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
_writePartToFile(i, remainingBytes, position * bytesPerSplit, sourceChannel, conta_split, numSplits + (remainingBytes > 0 ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
while("".equals(_sha1)){
|
||||
|
||||
while ("".equals(_sha1)) {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
split_button.setText("GENERATING SHA1, please wait...");
|
||||
|
||||
split_button.setText(LabelTranslatorSingleton.getInstance().translate("GENERATING SHA1, please wait..."));
|
||||
|
||||
});
|
||||
|
||||
|
||||
MiscTools.pausar(1000);
|
||||
}
|
||||
|
||||
if(_sha1!=null){
|
||||
Files.writeString(Paths.get(this._files[i].getAbsolutePath()+".sha1"), _sha1);
|
||||
|
||||
if (_sha1 != null) {
|
||||
Files.writeString(Paths.get(this._files[i].getAbsolutePath() + ".sha1"), _sha1);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -439,8 +439,6 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
this.jProgressBar2.setVisible(true);
|
||||
|
||||
pack();
|
||||
|
||||
|
||||
|
||||
Dialog tthis = this;
|
||||
|
||||
@ -460,7 +458,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
try {
|
||||
Desktop.getDesktop().open(_output_dir);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(FileSplitterDialog.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
Logger.getLogger(FileSplitterDialog.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1929,6 +1929,10 @@ public class LabelTranslatorSingleton {
|
||||
}
|
||||
|
||||
private void Spanish() {
|
||||
_addTranslation("FILE INTEGRITY IS OK", "LA INTEGRIDAD DEL ARCHIVO ES CORRECTA");
|
||||
_addTranslation("FILE INTEGRITY CHECK FAILED", "FALLÓ LA VERIFICACIÓN DE INTEGRIDAD DEL ARCHIVO");
|
||||
_addTranslation("CHECKING FILE INTEGRITY, please wait...", "COMPROBANDO INTEGRIDAD DEL ARCHIVO, por favor espera...");
|
||||
_addTranslation("GENERATING SHA1, please wait...", "GENERANDO SHA1, por favor espera...");
|
||||
_addTranslation("COPY ALL", "COPIAR TODO");
|
||||
_addTranslation("ALL COPIED!", "¡TODO COPIADO!");
|
||||
_addTranslation("FILE WITH SAME NAME AND SIZE ALREADY EXISTS", "YA EXISTE UN FICHERO CON EL MISMO NOMBRE Y TAMAÑO");
|
||||
|
@ -67,7 +67,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "7.71";
|
||||
public static final String VERSION = "7.72";
|
||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
|
@ -55,7 +55,6 @@ import java.nio.file.LinkOption;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.CodeSource;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DateFormat;
|
||||
@ -141,7 +140,7 @@ public class MiscTools {
|
||||
digest.update(buffer, 0, n);
|
||||
}
|
||||
}
|
||||
return new HexBinaryAdapter().marshal(digest.digest());
|
||||
return new HexBinaryAdapter().marshal(digest.digest()).toLowerCase().trim();
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user