Giving Rep++ for help! Made a few edits and IDK wtf is going on.
If you do find it I may send you some $$ ;]
Pls help me spot the issue
CacheDownloader.Java
Code:
package src;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class CacheDownloader {
private client client;
private final int BUFFER = 1024;
private final int VERSION = 1;
private String cacheLink = "dl.dropbox.com/s/kpyukoqs90mijn4/zepistyv1.0.zip?dl=1";
private String fileToExtract = getCacheDir() + getArchivedName();
public CacheDownloader(client client) {
this.client = client;
}
private void drawLoadingText(String text) {
client.drawLoadingText(35, text);
}
private void drawLoadingText(int amount, String text) {
client.drawLoadingText(amount, text);
}
private String getCacheDir() {
return signlink.findcachedir();
}
private String getCacheLink() {
return cacheLink;
}
private int getCacheVersion() {
return VERSION;
}
public CacheDownloader downloadCache() {
try {
File location = new File(getCacheDir());
File version = new File(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat");
if (!location.exists()) {
downloadFile(getCacheLink(), getArchivedName());
unZip();
deleteZIP(getArchivedName());
BufferedWriter versionFile = new BufferedWriter(new FileWriter(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat"));
versionFile.close();
} else {
if (!version.exists()) {
downloadFile(getCacheLink(), getArchivedName());
unZip();
deleteZIP(getArchivedName());
BufferedWriter versionFile = new BufferedWriter(new FileWriter(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat"));
versionFile.close();
} else {
return null;
}
}
} catch (Exception e) {
}
return null;
}
private void downloadFile(String adress, String localFileName) {
OutputStream out = null;
URLConnection conn;
InputStream in = null;
try {
URL url = new URL(adress);
out = new BufferedOutputStream(new FileOutputStream(getCacheDir() + "/" + localFileName));
conn = url.openConnection();
in = conn.getInputStream();
byte[] data = new byte[BUFFER];
int numRead;
long numWritten = 0;
int length = conn.getContentLength();
while ((numRead = in.read(data)) != -1) {
out.write(data, 0, numRead);
numWritten += numRead;
int percentage = (int) (((double) numWritten / (double) length) * 100D);
drawLoadingText(percentage, "Downloading Cache " + percentage + "%");
}
drawLoadingText("Updates are now complete. Please wait.");
} catch (Exception exception) {
exception.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException ioe) {
}
}
}
private String getArchivedName() {
int lastSlashIndex = getCacheLink().lastIndexOf('/');
if (lastSlashIndex >= 0 && lastSlashIndex < getCacheLink().length() - 1) {
return getCacheLink().substring(lastSlashIndex + 1);
} else {
}
return "";
}
private void unZip() {
try {
InputStream in = new BufferedInputStream(new FileInputStream(fileToExtract));
ZipInputStream zin = new ZipInputStream(in);
ZipEntry e;
while ((e = zin.getNextEntry()) != null) {
if (e.isDirectory()) {
(new File(getCacheDir() + e.getName())).mkdir();
} else {
if (e.getName().equals(fileToExtract)) {
unzip(zin, fileToExtract);
break;
}
unzip(zin, getCacheDir() + e.getName());
}
}
zin.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private void unzip(ZipInputStream zin, String s) throws IOException {
FileOutputStream out = new FileOutputStream(s);
byte[] b = new byte[BUFFER];
int len = 0;
while ((len = zin.read(b)) != -1) {
out.write(b, 0, len);
}
out.close();
}
private void deleteZIP(String fileName) {
// A File object to represent the filename
File f = new File(getCacheDir() + fileName);
// Make sure the file or directory exists and isn't write protected
if (!f.exists())
throw new IllegalArgumentException("Delete: no such file or directory: " + fileName);
if (!f.canWrite())
throw new IllegalArgumentException("Delete: write protected: " + fileName);
// If it is a directory, make sure it is empty
if (f.isDirectory()) {
String[] files = f.list();
if (files.length > 0)
throw new IllegalArgumentException("Delete: directory not empty: " + fileName);
}
// Attempt to delete it
boolean success = f.delete();
if (!success)
throw new IllegalArgumentException("Delete: deletion failed");
}
}
CMD error screen
Code:
Running in highmem
Error loading short keys!
java.io.FileNotFoundException: C:\Users\Austin\zepistyv1.0\Settings\shortkey.txt (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
at src.ShortKeysPanel.load(ShortKeysPanel.java:175)
at src.ShortKeysPanel.<init>(ShortKeysPanel.java:33)
at src.client.<init>(client.java:15673)
at src.client.main(client.java:1701)
java.net.MalformedURLException: no protocol: dl.dropbox.com/s/kpyukoqs90mijn4/zepistyv1.0.zip?dl=1
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at src.CacheDownloader.downloadFile(CacheDownloader.java:81)
at src.CacheDownloader.downloadCache(CacheDownloader.java:62)
at src.client.startUp(client.java:9887)
at src.RSApplet.run(RSApplet.java:86)
at src.client.run(client.java:6495)
at java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: C:\Users\Austin\zepistyv1.0\zepistyv1.0.zip?dl=1 (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at src.CacheDownloader.unZip(CacheDownloader.java:123)
at src.CacheDownloader.downloadCache(CacheDownloader.java:63)
at src.client.startUp(client.java:9887)
at src.RSApplet.run(RSApplet.java:86)
at src.client.run(client.java:6495)
at java.lang.Thread.run(Unknown Source)
Couldn't find details2.ini
Running in highmem
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at src.client.openSocket(client.java:1732)
at src.client.openJagGrabInputStream(client.java:13293)
at src.client.streamLoaderForName(client.java:5251)
at src.client.startUp(client.java:9915)
at src.RSApplet.run(RSApplet.java:86)
at src.client.run(client.java:6495)
at java.lang.Thread.run(Unknown Source)
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at src.client.openSocket(client.java:1732)
at src.client.openJagGrabInputStream(client.java:13293)
at src.client.streamLoaderForName(client.java:5251)
at src.client.startUp(client.java:9915)
at src.RSApplet.run(RSApplet.java:86)
at src.client.run(client.java:6495)
at java.lang.Thread.run(Unknown Source)