Thread: "ruse" auto cache download with dropbox

Results 1 to 8 of 8
  1. #1 "ruse" auto cache download with dropbox 
    BUYING AND SELLING ALL OSRS GOLD

    OSGP's Avatar
    Join Date
    May 2015
    Posts
    946
    Thanks given
    534
    Thanks received
    184
    Rep Power
    125
    hello guys i do not have webhost can anyone let me know how can i make cache auto download with drop box ?

    Bump



    Service Thread

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jun 2015
    Posts
    85
    Thanks given
    0
    Thanks received
    10
    Rep Power
    11
    "Share link" from dropbox folder, then when on the download page right click the download button and click copy link. There's your direct download link, treat it like a webhost.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member Adamq's Avatar
    Join Date
    Oct 2014
    Posts
    174
    Thanks given
    10
    Thanks received
    18
    Rep Power
    13
    Copy the public link and put dl. in front of the website link
    Reply With Quote  
     

  5. #4  
    BUYING AND SELLING ALL OSRS GOLD

    OSGP's Avatar
    Join Date
    May 2015
    Posts
    946
    Thanks given
    534
    Thanks received
    184
    Rep Power
    125
    Quote Originally Posted by Chris14987 View Post
    "Share link" from dropbox folder, then when on the download page right click the download button and click copy link. There's your direct download link, treat it like a webhost.
    This is my link and cachedownload.java can you please fixed it for me ?



    Code:
    https://www.dropbox.com/sh/9i4omaledk77m0d/AADNZE5Ecj3i_njnYe4tIIQSa?dl=0


    Code:
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    
    
    /**
     * Enchanced cache downloader
     * Handles cache downloading & unzipping
     * @author Gabriel Hannason
     */
    public class CacheDownloader {
    
    	public static void init() {
    		try {
    			for(CACHE_DOWNLOAD_FILES cacheFile : CACHE_DOWNLOAD_FILES.values()) {
    				boolean exists = new File(signlink.findcachedir() + cacheFile.identifier).exists();
    				if(!exists) {
    					int total = cacheFile.file.length;
    					int current = 1;
    					for(String file : cacheFile.file) {
    						downloadFile(cacheFile, file, current, total);
    						if(file.endsWith(".zip")) {
    							unzip(new File(signlink.findcachedir() + file));
    						}
    						current ++;
    					}
    					new File(signlink.findcachedir() + cacheFile.identifier).createNewFile();
    				}
    			}
    		} catch(Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public static void downloadFile(CACHE_DOWNLOAD_FILES cacheFile, String file, int current, int total) throws IOException {
    		String fileURL = "http://ruse-ps.com/client/cache/" + file;
    		String downloadingText = Client.optimizeText(cacheFile.toString().toLowerCase());
    		URL url = new URL(fileURL);
    		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
    		httpConn.addRequestProperty("User-Agent", "Mozilla/4.76");
    		int responseCode = httpConn.getResponseCode();
    
    		// always check HTTP response code first
    		if (responseCode == HttpURLConnection.HTTP_OK) {
    			String fileName = "";
    			String disposition = httpConn.getHeaderField("Content-Disposition");
    
    			if (disposition != null) {
    				// extracts file name from header field
    				int index = disposition.indexOf("filename=");
    				if (index > 0) {
    					fileName = disposition.substring(index + 10,
    							disposition.length() - 1);
    				}
    			} else {
    				// extracts file name from URL
    				fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
    						fileURL.length());
    			}
    
    			// opens input stream from the HTTP connection
    			InputStream inputStream = httpConn.getInputStream();
    			String saveFilePath = signlink.findcachedir() + File.separator + fileName;
    
    			// opens an output stream to save into file
    			FileOutputStream outputStream = new FileOutputStream(saveFilePath);
    
    			int bytesRead = -1;
    			byte[] buffer = new byte[4096];
    			long startTime = System.currentTimeMillis();
    			int downloaded = 0;
    			long numWritten = 0;
    			int length = httpConn.getContentLength();
    			while ((bytesRead = inputStream.read(buffer)) != -1) {
    				outputStream.write(buffer, 0, bytesRead);
    				numWritten += bytesRead;
    				downloaded += bytesRead;
    				int percentage = (int)(((double)numWritten / (double)length) * 100D);
    				int downloadSpeed = (int) ((downloaded / 1024) / (1 + ((System.currentTimeMillis() - startTime) / 1000)));
    				String s = total > 1 ? "("+current+"/"+total+")" : "";
    				drawLoadingText(percentage, (new StringBuilder()).append("Downloading "+downloadingText+""+s+": "+percentage+"% ").append("@ "+downloadSpeed+"Kb/s").toString());
    			}
    
    			outputStream.close();
    			inputStream.close();
    
    		} else {
    			System.out.println("SandyScape-PS.Com replied HTTP code: " + responseCode);
    		}
    		httpConn.disconnect();
    	}
    
    
    	private static void drawLoadingText(int amount, String text) {
    		Client.loadingPercentage = amount;
    		Client.loadingText = text;
    	}
    
    	private static void unzip(final File file) {
    		try {
    			InputStream in =  new BufferedInputStream(new FileInputStream(file));
    			ZipInputStream zin = new ZipInputStream(in);
    			ZipEntry e;
    			while((e=zin.getNextEntry()) != null) {
    				if(e.isDirectory()) {
    					(new File(signlink.findcachedir() + e.getName())).mkdir();
    				} else {
    					if (e.getName().equals(file.getName())) {
    						unzipPartlyArchive(zin, file.getName());
    						break;
    					}
    					unzipPartlyArchive(zin, signlink.findcachedir() + e.getName());
    				}
    			}
    			zin.close();
    			file.delete();
    		} catch(Exception e) {}
    	}
    
    	/**
    	 * Unzips a partly archive
    	 * @param zin	The zip inputstream
    	 * @param s		The location of the zip file
    	 * @throws IOException	The method can throw an IOException.
    	 */
    	private static void unzipPartlyArchive(ZipInputStream zin, String s) throws Exception {
    		FileOutputStream out = new FileOutputStream(s);
    		drawLoadingText(100, "Unpacking data..");
    		byte [] b = new byte[1024];
    		int len = 0;
    
    		while ((len = zin.read(b)) != -1) {
    			out.write(b,0,len);
    		}
    		out.close();
    	}
    
    	enum CACHE_DOWNLOAD_FILES {
    
    		IMAGES(new String[]{"sprites.idx", "sprites.dat", "icon.png"}, "cache1loaded"),
    		CACHE(new String[]{"SandyScape.dat", "SandyScape.idx0", "SandyScape.idx1", "SandyScape.idx2", "SandyScape.idx3", "SandyScape.idx4", "SandyScape.idx5", "SandyScape.idx6"}, "cache2loaded"),
    		DATA(new String[]{"data.zip"}, "cache3loaded"),
    		;
    
    		CACHE_DOWNLOAD_FILES(String[] file, String identifier) {
    			this.file = file;
    			this.identifier = identifier;
    		}
    
    		private String[] file;
    		private String identifier;
    	}
    }



    Service Thread

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  6. #5  
    Registered Member
    The Reverse's Avatar
    Join Date
    Nov 2014
    Posts
    945
    Thanks given
    168
    Thanks received
    289
    Rep Power
    520
    Quote Originally Posted by dr man 12 View Post
    This is my link and cachedownload.java can you please fixed it for me ?



    Code:
    https://www.dropbox.com/sh/9i4omaledk77m0d/AADNZE5Ecj3i_njnYe4tIIQSa?dl=0


    Code:
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    
    
    /**
     * Enchanced cache downloader
     * Handles cache downloading & unzipping
     * @author Gabriel Hannason
     */
    public class CacheDownloader {
    
    	public static void init() {
    		try {
    			for(CACHE_DOWNLOAD_FILES cacheFile : CACHE_DOWNLOAD_FILES.values()) {
    				boolean exists = new File(signlink.findcachedir() + cacheFile.identifier).exists();
    				if(!exists) {
    					int total = cacheFile.file.length;
    					int current = 1;
    					for(String file : cacheFile.file) {
    						downloadFile(cacheFile, file, current, total);
    						if(file.endsWith(".zip")) {
    							unzip(new File(signlink.findcachedir() + file));
    						}
    						current ++;
    					}
    					new File(signlink.findcachedir() + cacheFile.identifier).createNewFile();
    				}
    			}
    		} catch(Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public static void downloadFile(CACHE_DOWNLOAD_FILES cacheFile, String file, int current, int total) throws IOException {
    		String fileURL = "http://ruse-ps.com/client/cache/" + file;
    		String downloadingText = Client.optimizeText(cacheFile.toString().toLowerCase());
    		URL url = new URL(fileURL);
    		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
    		httpConn.addRequestProperty("User-Agent", "Mozilla/4.76");
    		int responseCode = httpConn.getResponseCode();
    
    		// always check HTTP response code first
    		if (responseCode == HttpURLConnection.HTTP_OK) {
    			String fileName = "";
    			String disposition = httpConn.getHeaderField("Content-Disposition");
    
    			if (disposition != null) {
    				// extracts file name from header field
    				int index = disposition.indexOf("filename=");
    				if (index > 0) {
    					fileName = disposition.substring(index + 10,
    							disposition.length() - 1);
    				}
    			} else {
    				// extracts file name from URL
    				fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
    						fileURL.length());
    			}
    
    			// opens input stream from the HTTP connection
    			InputStream inputStream = httpConn.getInputStream();
    			String saveFilePath = signlink.findcachedir() + File.separator + fileName;
    
    			// opens an output stream to save into file
    			FileOutputStream outputStream = new FileOutputStream(saveFilePath);
    
    			int bytesRead = -1;
    			byte[] buffer = new byte[4096];
    			long startTime = System.currentTimeMillis();
    			int downloaded = 0;
    			long numWritten = 0;
    			int length = httpConn.getContentLength();
    			while ((bytesRead = inputStream.read(buffer)) != -1) {
    				outputStream.write(buffer, 0, bytesRead);
    				numWritten += bytesRead;
    				downloaded += bytesRead;
    				int percentage = (int)(((double)numWritten / (double)length) * 100D);
    				int downloadSpeed = (int) ((downloaded / 1024) / (1 + ((System.currentTimeMillis() - startTime) / 1000)));
    				String s = total > 1 ? "("+current+"/"+total+")" : "";
    				drawLoadingText(percentage, (new StringBuilder()).append("Downloading "+downloadingText+""+s+": "+percentage+"% ").append("@ "+downloadSpeed+"Kb/s").toString());
    			}
    
    			outputStream.close();
    			inputStream.close();
    
    		} else {
    			System.out.println("SandyScape-PS.Com replied HTTP code: " + responseCode);
    		}
    		httpConn.disconnect();
    	}
    
    
    	private static void drawLoadingText(int amount, String text) {
    		Client.loadingPercentage = amount;
    		Client.loadingText = text;
    	}
    
    	private static void unzip(final File file) {
    		try {
    			InputStream in =  new BufferedInputStream(new FileInputStream(file));
    			ZipInputStream zin = new ZipInputStream(in);
    			ZipEntry e;
    			while((e=zin.getNextEntry()) != null) {
    				if(e.isDirectory()) {
    					(new File(signlink.findcachedir() + e.getName())).mkdir();
    				} else {
    					if (e.getName().equals(file.getName())) {
    						unzipPartlyArchive(zin, file.getName());
    						break;
    					}
    					unzipPartlyArchive(zin, signlink.findcachedir() + e.getName());
    				}
    			}
    			zin.close();
    			file.delete();
    		} catch(Exception e) {}
    	}
    
    	/**
    	 * Unzips a partly archive
    	 * @param zin	The zip inputstream
    	 * @param s		The location of the zip file
    	 * @throws IOException	The method can throw an IOException.
    	 */
    	private static void unzipPartlyArchive(ZipInputStream zin, String s) throws Exception {
    		FileOutputStream out = new FileOutputStream(s);
    		drawLoadingText(100, "Unpacking data..");
    		byte [] b = new byte[1024];
    		int len = 0;
    
    		while ((len = zin.read(b)) != -1) {
    			out.write(b,0,len);
    		}
    		out.close();
    	}
    
    	enum CACHE_DOWNLOAD_FILES {
    
    		IMAGES(new String[]{"sprites.idx", "sprites.dat", "icon.png"}, "cache1loaded"),
    		CACHE(new String[]{"SandyScape.dat", "SandyScape.idx0", "SandyScape.idx1", "SandyScape.idx2", "SandyScape.idx3", "SandyScape.idx4", "SandyScape.idx5", "SandyScape.idx6"}, "cache2loaded"),
    		DATA(new String[]{"data.zip"}, "cache3loaded"),
    		;
    
    		CACHE_DOWNLOAD_FILES(String[] file, String identifier) {
    			this.file = file;
    			this.identifier = identifier;
    		}
    
    		private String[] file;
    		private String identifier;
    	}
    }


    Code:
    [Only registered and activated users can see links. ]
    I think its

    Code:
    dl.dropbox.com/sh/9i4omaledk77m0d/AADNZE5Ecj3i_njnYe4tIIQSa?dl=0

    Darkness cannot drive out darkness; only light can do that. Hate cannot drive out hate; only love can do that.
    Martin Luther King, Jr.

    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    BUYING AND SELLING ALL OSRS GOLD

    OSGP's Avatar
    Join Date
    May 2015
    Posts
    946
    Thanks given
    534
    Thanks received
    184
    Rep Power
    125
    Quote Originally Posted by Encrypted_ View Post
    Code:
    [Only registered and activated users can see links. ]
    I think its

    Code:
    dl.dropbox.com/sh/9i4omaledk77m0d/AADNZE5Ecj3i_njnYe4tIIQSa?dl=0

    do you have skype bro and also link don't work



    Service Thread

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  9. #7  
    Super Donator

    Join Date
    Jul 2016
    Posts
    61
    Thanks given
    7
    Thanks received
    8
    Rep Power
    49
    It would be [Only registered and activated users can see links. ]dl=1


    the 1 makes it auto download
    Reply With Quote  
     

  10. #8  
    Registered Member
    Join Date
    Apr 2020
    Posts
    3
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Quote Originally Posted by Riggster View Post
    It would be [Only registered and activated users can see links. ]dl=1


    the 1 makes it auto download
    This worked for me i was having this issue with the cache auto downloading untill i set the value to 1
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Help with auto cache download please!!![pi]
    By DatguyJay in forum Help
    Replies: 6
    Last Post: 06-02-2011, 12:08 AM
  2. Replies: 1
    Last Post: 05-15-2010, 07:31 AM
  3. WebClient with auto cache downloader
    By Darna in forum Help
    Replies: 1
    Last Post: 08-14-2009, 02:11 PM
  4. Replies: 1
    Last Post: 02-13-2009, 07:32 PM
  5. Replies: 65
    Last Post: 04-10-2008, 04:42 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •