File split/merge sha1 removed
This commit is contained in:
tonikelope 2024-08-05 19:14:09 +02:00
parent fc03de1d3b
commit 53c65de717
2 changed files with 8 additions and 28 deletions

View File

@ -41,7 +41,6 @@ public class FileSplitterDialog extends javax.swing.JDialog {
private final MainPanel _main_panel; private final MainPanel _main_panel;
private File[] _files = null; private File[] _files = null;
private File _output_dir = null; private File _output_dir = null;
private volatile String _sha1 = null;
private volatile long _progress = 0L; private volatile long _progress = 0L;
private volatile Path _current_part = null; private volatile Path _current_part = null;
private volatile int _current_file = 0; private volatile int _current_file = 0;
@ -86,17 +85,6 @@ public class FileSplitterDialog extends javax.swing.JDialog {
private boolean _splitFile(int i) throws IOException { private boolean _splitFile(int i) throws IOException {
_sha1 = "";
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; this._progress = 0L;
int mBperSplit = Integer.parseInt(this.split_size_text.getText()); int mBperSplit = Integer.parseInt(this.split_size_text.getText());
@ -135,20 +123,6 @@ public class FileSplitterDialog extends javax.swing.JDialog {
} }
} }
while ("".equals(_sha1)) {
MiscTools.GUIRunAndWait(() -> {
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);
}
return true; return true;
} }
@ -195,9 +169,13 @@ public class FileSplitterDialog extends javax.swing.JDialog {
monitorProgress(f, byteSize); monitorProgress(f, byteSize);
if (!_exit) { if (!_exit) {
long dest_bytes_copied = Files.exists(fileName) ? Files.size(fileName) : 0;
try (RandomAccessFile toFile = new RandomAccessFile(fileName.toFile(), "rw"); FileChannel toChannel = toFile.getChannel()) { try (RandomAccessFile toFile = new RandomAccessFile(fileName.toFile(), "rw"); FileChannel toChannel = toFile.getChannel()) {
sourceChannel.position(position); while (dest_bytes_copied < byteSize) {
toChannel.transferFrom(sourceChannel, 0, byteSize); sourceChannel.position(position + dest_bytes_copied);
dest_bytes_copied += toChannel.transferFrom(sourceChannel, dest_bytes_copied, byteSize - dest_bytes_copied);
}
} }
} }

View File

@ -276,6 +276,8 @@ public final class MainPanelView extends javax.swing.JFrame {
if (dialog.getUpload_log_checkbox().isSelected()) { if (dialog.getUpload_log_checkbox().isSelected()) {
MiscTools.createUploadLogDir();
File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + parent_node + ".log"); File upload_log = new File(MiscTools.UPLOAD_LOGS_DIR + "/megabasterd_upload_" + parent_node + ".log");
upload_log.createNewFile(); upload_log.createNewFile();