mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-21 00:37:12 +02:00
7.76
Advanced settings mega api key disabled (no longer required)
This commit is contained in:
parent
2c409eb441
commit
b7598c88c4
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>7.75</version>
|
||||
<version>7.76</version>
|
||||
<packaging>jar</packaging>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -302,7 +302,7 @@ public class ChunkDownloader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
tmp_chunk_file = new File(_download.getChunkmanager().getChunks_dir() + "/" + new File(_download.getFile_name()).getName() + ".chunk" + chunk_id + ".tmp");
|
||||
|
||||
try ( InputStream is = new ThrottledInputStream(con.getInputStream(), _download.getMain_panel().getStream_supervisor()); OutputStream tmp_chunk_file_os = new BufferedOutputStream(new FileOutputStream(tmp_chunk_file))) {
|
||||
try (InputStream is = new ThrottledInputStream(con.getInputStream(), _download.getMain_panel().getStream_supervisor()); OutputStream tmp_chunk_file_os = new BufferedOutputStream(new FileOutputStream(tmp_chunk_file))) {
|
||||
|
||||
init_chunk_time = System.currentTimeMillis();
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
ByteArrayOutputStream chunk_mac = new ByteArrayOutputStream();
|
||||
|
||||
try ( QueueInputStream qis = new QueueInputStream(); QueueOutputStream qos = qis.newQueueOutputStream(); BufferedInputStream bis = new BufferedInputStream(Channels.newInputStream(f.getChannel())); CipherInputStream cis = new CipherInputStream(qis, genCrypter("AES", "AES/CTR/NoPadding", _upload.getByte_file_key(), forwardMEGALinkKeyIV(_upload.getByte_file_iv(), chunk_offset))); OutputStream out = new ThrottledOutputStream(con.getOutputStream(), _upload.getMain_panel().getStream_supervisor())) {
|
||||
try (QueueInputStream qis = new QueueInputStream(); QueueOutputStream qos = qis.newQueueOutputStream(); BufferedInputStream bis = new BufferedInputStream(Channels.newInputStream(f.getChannel())); CipherInputStream cis = new CipherInputStream(qis, genCrypter("AES", "AES/CTR/NoPadding", _upload.getByte_file_key(), forwardMEGALinkKeyIV(_upload.getByte_file_iv(), chunk_offset))); OutputStream out = new ThrottledOutputStream(con.getOutputStream(), _upload.getMain_panel().getStream_supervisor())) {
|
||||
|
||||
LOG.log(Level.INFO, "{0} Uploading chunk {1} from worker {2} {3}...", new Object[]{Thread.currentThread().getName(), chunk_id, _id, _upload.getFile_name()});
|
||||
|
||||
@ -251,7 +251,7 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
|
||||
|
||||
String httpresponse;
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
while ((reads = is.read(buffer)) != -1) {
|
||||
byte_res.write(buffer, 0, reads);
|
||||
|
@ -214,7 +214,7 @@ public class ChunkWriterManager implements Runnable, SecureSingleThreadNotifiabl
|
||||
|
||||
int reads;
|
||||
|
||||
try ( CipherInputStream cis = new CipherInputStream(new BufferedInputStream(new FileInputStream(chunk_file)), genDecrypter("AES", "AES/CTR/NoPadding", _byte_file_key, forwardMEGALinkKeyIV(_byte_iv, _bytes_written)))) {
|
||||
try (CipherInputStream cis = new CipherInputStream(new BufferedInputStream(new FileInputStream(chunk_file)), genDecrypter("AES", "AES/CTR/NoPadding", _byte_file_key, forwardMEGALinkKeyIV(_byte_iv, _bytes_written)))) {
|
||||
while ((reads = cis.read(buffer)) != -1) {
|
||||
_download.getOutput_stream().write(buffer, 0, reads);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ public class CryptTools {
|
||||
|
||||
if (compression) {
|
||||
|
||||
try ( InputStream is = new GZIPInputStream(new ByteArrayInputStream(elc_byte)); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = new GZIPInputStream(new ByteArrayInputStream(elc_byte)); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
@ -437,7 +437,7 @@ public class CryptTools {
|
||||
|
||||
con.getOutputStream().close();
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
@ -558,7 +558,7 @@ public class CryptTools {
|
||||
|
||||
String enc_dlc_key;
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream()) {
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
int reads;
|
||||
while ((reads = is.read(buffer)) != -1) {
|
||||
|
@ -30,7 +30,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void setupSqliteTables() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.executeUpdate("CREATE TABLE IF NOT EXISTS downloads(url TEXT, email TEXT, path TEXT, filename TEXT, filekey TEXT, filesize UNSIGNED BIG INT, filepass VARCHAR(64), filenoexpire VARCHAR(64), custom_chunks_dir TEXT, PRIMARY KEY ('url'), UNIQUE(path, filename));");
|
||||
stat.executeUpdate("CREATE TABLE IF NOT EXISTS uploads(filename TEXT, email TEXT, url TEXT, ul_key TEXT, parent_node TEXT, root_node TEXT, share_key TEXT, folder_link TEXT, bytes_uploaded UNSIGNED BIG INT, meta_mac TEXT, PRIMARY KEY ('filename'), UNIQUE(filename, email));");
|
||||
@ -45,7 +45,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void vaccum() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("VACUUM");
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertDownloadsQueue(ArrayList<String> queue) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO downloads_queue (url) VALUES (?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO downloads_queue (url) VALUES (?)")) {
|
||||
|
||||
if (!queue.isEmpty()) {
|
||||
|
||||
@ -75,7 +75,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM downloads_queue ORDER BY rowid");
|
||||
|
||||
@ -90,7 +90,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void truncateDownloadsQueue() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("DELETE FROM downloads_queue");
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertUploadsQueue(ArrayList<String> queue) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO uploads_queue (filename) VALUES (?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO uploads_queue (filename) VALUES (?)")) {
|
||||
|
||||
if (!queue.isEmpty()) {
|
||||
|
||||
@ -120,7 +120,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM uploads_queue ORDER BY rowid");
|
||||
|
||||
@ -135,7 +135,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void truncateUploadsQueue() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("DELETE FROM uploads_queue");
|
||||
}
|
||||
@ -143,7 +143,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertMegaSession(String email, byte[] ma, boolean crypt) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_sessions (email, ma, crypt) VALUES (?,?,?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_sessions (email, ma, crypt) VALUES (?,?,?)")) {
|
||||
|
||||
ps.setString(1, email);
|
||||
ps.setBytes(2, ma);
|
||||
@ -155,7 +155,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void truncateMegaSessions() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("DELETE FROM mega_sessions");
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class DBTools {
|
||||
|
||||
HashMap<String, Object> session = null;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT * from mega_sessions WHERE email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT * from mega_sessions WHERE email=?")) {
|
||||
|
||||
ps.setString(1, email);
|
||||
|
||||
@ -190,7 +190,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertDownload(String url, String email, String path, String filename, String filekey, Long size, String filepass, String filenoexpire, String custom_chunks_dir) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT INTO downloads (url, email, path, filename, filekey, filesize, filepass, filenoexpire, custom_chunks_dir) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT INTO downloads (url, email, path, filename, filekey, filesize, filepass, filenoexpire, custom_chunks_dir) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||
|
||||
ps.setString(1, url);
|
||||
ps.setString(2, email);
|
||||
@ -208,7 +208,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteDownload(String url) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM downloads WHERE url=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM downloads WHERE url=?")) {
|
||||
|
||||
ps.setString(1, url);
|
||||
|
||||
@ -219,7 +219,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteDownloads(String[] urls) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM downloads WHERE url=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM downloads WHERE url=?")) {
|
||||
|
||||
for (String url : urls) {
|
||||
|
||||
@ -234,7 +234,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertUpload(String filename, String email, String parent_node, String ul_key, String root_node, String share_key, String folder_link) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT INTO uploads (filename, email, parent_node, ul_key, root_node, share_key, folder_link, bytes_uploaded, meta_mac) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT INTO uploads (filename, email, parent_node, ul_key, root_node, share_key, folder_link, bytes_uploaded, meta_mac) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||
|
||||
ps.setString(1, filename);
|
||||
ps.setString(2, email);
|
||||
@ -252,7 +252,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void updateUploadUrl(String filename, String email, String ul_url) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("UPDATE uploads SET url=? WHERE filename=? AND email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("UPDATE uploads SET url=? WHERE filename=? AND email=?")) {
|
||||
|
||||
ps.setString(1, ul_url);
|
||||
ps.setString(2, filename);
|
||||
@ -264,7 +264,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void updateUploadProgress(String filename, String email, Long bytes_uploaded, String meta_mac) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("UPDATE uploads SET bytes_uploaded=?,meta_mac=? WHERE filename=? AND email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("UPDATE uploads SET bytes_uploaded=?,meta_mac=? WHERE filename=? AND email=?")) {
|
||||
|
||||
ps.setLong(1, bytes_uploaded);
|
||||
ps.setString(2, meta_mac);
|
||||
@ -277,7 +277,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized HashMap<String, Object> selectUploadProgress(String filename, String email) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT bytes_uploaded,meta_mac FROM uploads WHERE filename=? AND email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT bytes_uploaded,meta_mac FROM uploads WHERE filename=? AND email=?")) {
|
||||
|
||||
ps.setString(1, filename);
|
||||
ps.setString(2, email);
|
||||
@ -297,7 +297,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteUpload(String filename, String email) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM uploads WHERE filename=? AND email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM uploads WHERE filename=? AND email=?")) {
|
||||
|
||||
ps.setString(1, filename);
|
||||
|
||||
@ -309,7 +309,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteUploads(String[][] uploads) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM uploads WHERE filename=? AND email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE FROM uploads WHERE filename=? AND email=?")) {
|
||||
|
||||
for (String[] upload : uploads) {
|
||||
|
||||
@ -326,7 +326,7 @@ public class DBTools {
|
||||
|
||||
String value = null;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT value from settings WHERE key=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("SELECT value from settings WHERE key=?")) {
|
||||
|
||||
ps.setString(1, key);
|
||||
|
||||
@ -344,7 +344,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertSettingValue(String key, String value) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO settings (key,value) VALUES (?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO settings (key,value) VALUES (?, ?)")) {
|
||||
|
||||
ps.setString(1, key);
|
||||
|
||||
@ -360,7 +360,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM settings");
|
||||
|
||||
@ -375,7 +375,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertSettingsValues(HashMap<String, Object> settings) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO settings (key,value) VALUES (?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO settings (key,value) VALUES (?, ?)")) {
|
||||
|
||||
for (Map.Entry<String, Object> entry : settings.entrySet()) {
|
||||
|
||||
@ -394,7 +394,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM downloads");
|
||||
|
||||
@ -424,7 +424,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM uploads");
|
||||
|
||||
@ -455,7 +455,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM mega_accounts");
|
||||
|
||||
@ -476,7 +476,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertMegaAccounts(HashMap<String, Object> accounts) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_accounts (email,password,password_aes,user_hash) VALUES (?, ?, ?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_accounts (email,password,password_aes,user_hash) VALUES (?, ?, ?, ?)")) {
|
||||
|
||||
if (!accounts.isEmpty()) {
|
||||
|
||||
@ -500,7 +500,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertELCAccounts(HashMap<String, Object> accounts) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO elc_accounts (host,user,apikey) VALUES (?, ?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO elc_accounts (host,user,apikey) VALUES (?, ?, ?)")) {
|
||||
|
||||
if (!accounts.isEmpty()) {
|
||||
|
||||
@ -527,7 +527,7 @@ public class DBTools {
|
||||
|
||||
ResultSet res;
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
res = stat.executeQuery("SELECT * FROM elc_accounts");
|
||||
|
||||
@ -547,7 +547,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertMegaAccount(String email, String password, String password_aes, String user_hash) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_accounts (email,password,password_aes,user_hash) VALUES (?, ?, ?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO mega_accounts (email,password,password_aes,user_hash) VALUES (?, ?, ?, ?)")) {
|
||||
|
||||
ps.setString(1, email);
|
||||
|
||||
@ -565,7 +565,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void insertELCAccount(String host, String user, String apikey) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO elc_accounts (host,user,apikey) VALUES (?, ?, ?)")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT OR REPLACE INTO elc_accounts (host,user,apikey) VALUES (?, ?, ?)")) {
|
||||
|
||||
ps.setString(1, host);
|
||||
|
||||
@ -580,7 +580,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteMegaAccount(String email) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE from mega_accounts WHERE email=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE from mega_accounts WHERE email=?")) {
|
||||
|
||||
ps.setString(1, email);
|
||||
|
||||
@ -590,7 +590,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void deleteELCAccount(String host) throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE from elc_accounts WHERE host=?")) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("DELETE from elc_accounts WHERE host=?")) {
|
||||
|
||||
ps.setString(1, host);
|
||||
|
||||
@ -600,7 +600,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void truncateMegaAccounts() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("DELETE FROM mega_accounts");
|
||||
}
|
||||
@ -608,7 +608,7 @@ public class DBTools {
|
||||
|
||||
public static synchronized void truncateELCAccounts() throws SQLException {
|
||||
|
||||
try ( Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("DELETE FROM elc_accounts");
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Truncating temp file...");
|
||||
|
||||
try ( FileChannel out_truncate = new FileOutputStream(temp_filename, true).getChannel()) {
|
||||
try (FileChannel out_truncate = new FileOutputStream(temp_filename, true).getChannel()) {
|
||||
out_truncate.truncate(max_size);
|
||||
}
|
||||
}
|
||||
@ -1359,7 +1359,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
Cipher cryptor = genCrypter("AES", "AES/CBC/NoPadding", byte_file_key, i32a2bin(cbc_iv));
|
||||
|
||||
try ( BufferedInputStream is = new BufferedInputStream(new FileInputStream(filename))) {
|
||||
try (BufferedInputStream is = new BufferedInputStream(new FileInputStream(filename))) {
|
||||
|
||||
long chunk_id = 1L;
|
||||
long tot = 0L;
|
||||
|
@ -106,7 +106,7 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
|
||||
private boolean _mergeFile() throws IOException {
|
||||
|
||||
try ( RandomAccessFile targetFile = new RandomAccessFile(_file_name_full, "rw")) {
|
||||
try (RandomAccessFile targetFile = new RandomAccessFile(_file_name_full, "rw")) {
|
||||
|
||||
FileChannel targetChannel = targetFile.getChannel();
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
|
||||
});
|
||||
|
||||
try ( RandomAccessFile sourceFile = new RandomAccessFile(this._files[i].getAbsolutePath(), "r"); FileChannel sourceChannel = sourceFile.getChannel()) {
|
||||
try (RandomAccessFile sourceFile = new RandomAccessFile(this._files[i].getAbsolutePath(), "r"); FileChannel sourceChannel = sourceFile.getChannel()) {
|
||||
|
||||
for (; position < numSplits && !_exit; position++, conta_split++) {
|
||||
_writePartToFile(i, bytesPerSplit, position * bytesPerSplit, sourceChannel, conta_split, numSplits + (remainingBytes > 0 ? 1 : 0));
|
||||
@ -195,7 +195,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
monitorProgress(f, byteSize);
|
||||
|
||||
if (!_exit) {
|
||||
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);
|
||||
toChannel.transferFrom(sourceChannel, 0, byteSize);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "7.75";
|
||||
public static final String VERSION = "7.76";
|
||||
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;
|
||||
@ -399,7 +399,6 @@ public final class MainPanel {
|
||||
openBrowserURL("https://mega.nz/sdk");
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
public static Boolean getResume_uploads() {
|
||||
|
@ -366,7 +366,7 @@ public class MegaAPI implements Serializable {
|
||||
}
|
||||
|
||||
private String _rawRequest(String request, URL url_api) throws MegaAPIException {
|
||||
|
||||
|
||||
System.out.println(request);
|
||||
|
||||
String response = null, current_smart_proxy = null;
|
||||
@ -482,7 +482,7 @@ public class MegaAPI implements Serializable {
|
||||
|
||||
} else {
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
@ -795,12 +795,12 @@ public class MegaAPI implements Serializable {
|
||||
|
||||
int reads;
|
||||
|
||||
try ( OutputStream out = new ThrottledOutputStream(con.getOutputStream(), upload.getMain_panel().getStream_supervisor())) {
|
||||
try (OutputStream out = new ThrottledOutputStream(con.getOutputStream(), upload.getMain_panel().getStream_supervisor())) {
|
||||
|
||||
out.write(file_bytes[h]);
|
||||
}
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
while ((reads = is.read(buffer)) != -1) {
|
||||
byte_res.write(buffer, 0, reads);
|
||||
|
@ -81,7 +81,7 @@ public class MegaCrypterAPI {
|
||||
|
||||
} else {
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class MiscTools {
|
||||
|
||||
public static void deleteDirectoryRecursion(Path path) throws IOException {
|
||||
if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) {
|
||||
try ( DirectoryStream<Path> entries = Files.newDirectoryStream(path)) {
|
||||
try (DirectoryStream<Path> entries = Files.newDirectoryStream(path)) {
|
||||
for (Path entry : entries) {
|
||||
deleteDirectoryRecursion(entry);
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ public class MiscTools {
|
||||
|
||||
con.setUseCaches(false);
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
@ -1165,7 +1165,7 @@ public class MiscTools {
|
||||
|
||||
con.setUseCaches(false);
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
@ -1435,7 +1435,7 @@ public class MiscTools {
|
||||
|
||||
ByteArrayInputStream bs = new ByteArrayInputStream(CryptTools.aes_cbc_decrypt_pkcs7((byte[]) old_session_data.get("ma"), main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
|
||||
|
||||
try ( ObjectInputStream is = new ObjectInputStream(bs)) {
|
||||
try (ObjectInputStream is = new ObjectInputStream(bs)) {
|
||||
|
||||
old_ma = (MegaAPI) is.readObject();
|
||||
|
||||
@ -1447,7 +1447,7 @@ public class MiscTools {
|
||||
|
||||
ByteArrayInputStream bs = new ByteArrayInputStream((byte[]) old_session_data.get("ma"));
|
||||
|
||||
try ( ObjectInputStream is = new ObjectInputStream(bs)) {
|
||||
try (ObjectInputStream is = new ObjectInputStream(bs)) {
|
||||
old_ma = (MegaAPI) is.readObject();
|
||||
} catch (Exception ex) {
|
||||
unserialization_error = true;
|
||||
@ -1488,7 +1488,7 @@ public class MiscTools {
|
||||
|
||||
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
||||
|
||||
try ( ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
try (ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
os.writeObject(ma);
|
||||
}
|
||||
|
||||
|
@ -1099,10 +1099,13 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="start_frozen_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="debug_file_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="custom_chunks_dir_button" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_button" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="165" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_current_label" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="rec_zoom_label" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
@ -1141,12 +1144,12 @@
|
||||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_checkbox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="custom_chunks_dir_checkbox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_button" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_current_label" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="custom_chunks_dir_current_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="mega_api_key_panel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
@ -1578,6 +1581,9 @@
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="mega_api_key_panel">
|
||||
<Properties>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
@ -1620,9 +1626,6 @@
|
||||
<Property name="text" type="java.lang.String" value="MEGA API KEY:"/>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mega_api_key_labelMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="mega_api_key">
|
||||
<Properties>
|
||||
@ -1630,6 +1633,7 @@
|
||||
<Font name="Dialog" size="18" style="0"/>
|
||||
</Property>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="mega_api_key.addMouseListener(new ContextMenuMouseListener());"/>
|
||||
@ -1640,16 +1644,16 @@
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="14" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="WARNING: USING MEGA API WITHOUT API KEY MAY VIOLATE ITS TERM OF USE. YOU SHOULD GET A KEY -> https://mega.nz/sdk"/>
|
||||
<Property name="text" type="java.lang.String" value="MEGA API KEY IS NO LONGER REQUIRED (DISABLED)"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Cursor de Mano"/>
|
||||
</Property>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="mega_api_key_warningMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
@ -1599,28 +1599,22 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
debug_file_checkbox.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
debug_file_checkbox.setText("Save debug info to file");
|
||||
|
||||
mega_api_key_panel.setOpaque(false);
|
||||
|
||||
mega_api_key_label.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
mega_api_key_label.setText("MEGA API KEY:");
|
||||
mega_api_key_label.setDoubleBuffered(true);
|
||||
mega_api_key_label.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
mega_api_key_labelMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mega_api_key.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
||||
mega_api_key.setDoubleBuffered(true);
|
||||
mega_api_key.setEnabled(false);
|
||||
|
||||
mega_api_key_warning.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
|
||||
mega_api_key_warning.setForeground(new java.awt.Color(0, 0, 255));
|
||||
mega_api_key_warning.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
mega_api_key_warning.setText("WARNING: USING MEGA API WITHOUT API KEY MAY VIOLATE ITS TERM OF USE. YOU SHOULD GET A KEY -> https://mega.nz/sdk");
|
||||
mega_api_key_warning.setText("MEGA API KEY IS NO LONGER REQUIRED (DISABLED)");
|
||||
mega_api_key_warning.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
|
||||
mega_api_key_warning.setDoubleBuffered(true);
|
||||
mega_api_key_warning.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
mega_api_key_warningMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout mega_api_key_panelLayout = new javax.swing.GroupLayout(mega_api_key_panel);
|
||||
mega_api_key_panel.setLayout(mega_api_key_panelLayout);
|
||||
@ -1684,10 +1678,12 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
.addGroup(advanced_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(start_frozen_checkbox)
|
||||
.addComponent(debug_file_checkbox)
|
||||
.addComponent(custom_chunks_dir_checkbox)
|
||||
.addGroup(advanced_panelLayout.createSequentialGroup()
|
||||
.addComponent(custom_chunks_dir_button)
|
||||
.addComponent(custom_chunks_dir_checkbox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(custom_chunks_dir_button))
|
||||
.addGroup(advanced_panelLayout.createSequentialGroup()
|
||||
.addGap(165, 165, 165)
|
||||
.addComponent(custom_chunks_dir_current_label))
|
||||
.addComponent(rec_zoom_label)
|
||||
.addGroup(advanced_panelLayout.createSequentialGroup()
|
||||
@ -1716,11 +1712,11 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
.addComponent(language_combo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jButton1))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(custom_chunks_dir_checkbox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(advanced_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(custom_chunks_dir_button)
|
||||
.addComponent(custom_chunks_dir_current_label))
|
||||
.addComponent(custom_chunks_dir_checkbox)
|
||||
.addComponent(custom_chunks_dir_button))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(custom_chunks_dir_current_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(mega_api_key_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
@ -2152,7 +2148,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
||||
|
||||
try ( ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
try (ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
os.writeObject(ma);
|
||||
}
|
||||
|
||||
@ -2239,7 +2235,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
||||
|
||||
try ( ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
try (ObjectOutputStream os = new ObjectOutputStream(bs)) {
|
||||
os.writeObject(ma);
|
||||
}
|
||||
|
||||
@ -2850,7 +2846,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
try ( BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file)); ObjectOutputStream oos = new ObjectOutputStream(fos)) {
|
||||
try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file)); ObjectOutputStream oos = new ObjectOutputStream(fos)) {
|
||||
|
||||
HashMap<String, Object> settings = new HashMap<>();
|
||||
|
||||
@ -2901,7 +2897,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
try {
|
||||
|
||||
try ( InputStream fis = new BufferedInputStream(new FileInputStream(file)); ObjectInputStream ois = new ObjectInputStream(fis)) {
|
||||
try (InputStream fis = new BufferedInputStream(new FileInputStream(file)); ObjectInputStream ois = new ObjectInputStream(fis)) {
|
||||
|
||||
HashMap<String, Object> settings = (HashMap<String, Object>) ois.readObject();
|
||||
|
||||
@ -3070,16 +3066,6 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
megacrypter_reverse_warning_label.setEnabled(megacrypter_reverse_checkbox.isSelected());
|
||||
}//GEN-LAST:event_megacrypter_reverse_checkboxStateChanged
|
||||
|
||||
private void mega_api_key_warningMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mega_api_key_warningMouseClicked
|
||||
// TODO add your handling code here:
|
||||
openBrowserURL("https://mega.nz/sdk");
|
||||
}//GEN-LAST:event_mega_api_key_warningMouseClicked
|
||||
|
||||
private void mega_api_key_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mega_api_key_labelMouseClicked
|
||||
// TODO add your handling code here:
|
||||
mega_api_key_warningMouseClicked(evt);
|
||||
}//GEN-LAST:event_mega_api_key_labelMouseClicked
|
||||
|
||||
private void import_mega_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_import_mega_buttonActionPerformed
|
||||
// TODO add your handling code here:
|
||||
|
||||
|
@ -185,7 +185,7 @@ public final class SmartMegaProxyManager {
|
||||
|
||||
con.setRequestProperty("User-Agent", MainPanel.DEFAULT_USER_AGENT);
|
||||
|
||||
try ( InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
try (InputStream is = con.getInputStream(); ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
|
@ -201,7 +201,7 @@ public class StreamChunkDownloader implements Runnable {
|
||||
|
||||
} else {
|
||||
|
||||
try ( InputStream is = con.getInputStream()) {
|
||||
try (InputStream is = con.getInputStream()) {
|
||||
|
||||
int chunk_writes = 0;
|
||||
|
||||
|
@ -151,11 +151,11 @@ public class UploadMACGenerator implements Runnable, SecureSingleThreadNotifiabl
|
||||
|
||||
long conta_chunk = 0L;
|
||||
|
||||
try ( ByteArrayOutputStream baos = CHUNK_QUEUE.remove(chunk_offset)) {
|
||||
try (ByteArrayOutputStream baos = CHUNK_QUEUE.remove(chunk_offset)) {
|
||||
chunk_bytes = baos.toByteArray();
|
||||
}
|
||||
|
||||
try ( ByteArrayInputStream bais = new ByteArrayInputStream(chunk_bytes)) {
|
||||
try (ByteArrayInputStream bais = new ByteArrayInputStream(chunk_bytes)) {
|
||||
while (conta_chunk < chunk_size && (reads = bais.read(byte_block)) != -1) {
|
||||
|
||||
if (reads < byte_block.length) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 200 KiB |
Loading…
x
Reference in New Issue
Block a user