Thread: [PI]CacheDownloader[FULLY WORKING]Google411

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 45
  1. #1 [PI]CacheDownloader[FULLY WORKING]Google411 
    Google it ffs

    Reich's Avatar
    Join Date
    Mar 2011
    Age
    20
    Posts
    707
    Thanks given
    98
    Thanks received
    163
    Rep Power
    98
    This is my new flawless noob proof uber CacheDownlaoder.

    It's time for an update i presume. Didn't take too long to do about two hours adding drink breaks etc.

    If you already have the original CacheDownloader.java and wish to update to this version go to step 1
    If you don't have the CacheDownlaoder.java follow the tutorial here



    1. Go into your client.java and search
    Code:
    new CacheDownloader(this).downloadCache();
    Make sure the above is in the code
    If you have done my other tutorial successfully you don't need to know how to do this
    Save and close client.java

    2. now open CacheDownloader.java and replace the whole file with this:
    Code:
    /**********************************************
    
    @author: Google411
    
    06/11/2011
    
    CacheDownloader.java
    Version: 2.00.12
    
    Notes:
    Thank-you openice123 for this. Thank-you Onlyme for a quick fix.
    And thank you JUSTINNN for the original post! FROM Rune-Server
    ORIGINAL RAW CODE: http://paste.rune-server.org/905
    
    $$ If you want to disable the pipup messages just null out these lines
    
    Line: 102 - 
    cacheHasUpdated();
    Line: 108 - 
    cacheHasUpdated();
    With
    Line: 102 - 
    //cacheHasUpdated();
    Line: 108 - 
    //cacheHasUpdated();
    
    For you'z nub'z  <><> Google411 Me
    
    
    **********************************************/
    
    import java.io.File;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.FileWriter;
    import java.io.BufferedWriter;
    import java.io.BufferedOutputStream;
    import java.io.BufferedInputStream;
    import java.io.FileOutputStream;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.net.URLConnection;
    import java.net.URL;
    import java.util.zip.ZipFile;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipInputStream;
    import java.util.Enumeration;
    import javax.swing.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import sign.signlink;
    
    public class CacheDownloader {
    
            private client client;
    		client frame;
            private final int BUFFER = 1024;
    		/* OPTIONS START HERE *///----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            /* OPTION 1 */private final int VERSION = 1 ;   // Version of cache, make it +1 if you updated your cache on your remote server
    		/* OPTION 2 */private final int pauseHandlerDelay = 1000 ;   // 1000  = 1 second. This is for when ever the pauseHandler void is called. It just pauses the entire code for the amount of time set.
            /* OPTION 3*/private String cacheLink = "http://127.0.0.1/cache.zip" ;   // URL of cache on remote server. IE: "http://google.com/cache.zip"
    		/* OPTION 4 */private String cacheDir = "C:/google/" ;   // Local link to cache directory - Same as sign.signlink.findcachedir() - Remember trailing '/' 
    		/* OPTIONS END HERE *///--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            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 getCacheLink() {
                    return cacheLink;
            }
    		
            private String getCacheDir() {
                    return cacheDir;
            }
    
            private int getCacheVersion() {
                    return VERSION;
            }
    		
    		private int pauseHandlerDelay1000Equals1Second() {
    				return pauseHandlerDelay;
    		}
    	
    		private String localCacheFile() {
    				return getCacheDir() + getArchivedName();
    		}
            public CacheDownloader downloadCache() {
                    try {
                    File location = new File(getCacheDir());
                    File version = new File(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat");
                    if(!location.exists()) {
    						cacheHasUpdated();
                            downloadFile(getCacheLink(), getArchivedName());
                            BufferedWriter versionFile = new BufferedWriter(new FileWriter(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat"));
                            versionFile.close();
                    } else {
                            if(!version.exists()) {
    								cacheHasUpdated();
                                    downloadFile(getCacheLink(), getArchivedName());
                                    BufferedWriter versionFile = new BufferedWriter(new FileWriter(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat"));
                                    versionFile.close();
                            } else {
                                    return null;
                            }
                    }
                    } catch(Exception e) {
                    }
                    return null;
            }			
    			public void cacheHasUpdated() {
    				JOptionPane.showMessageDialog(frame, "It seems you either, 1. Have no cache on localhost or, 2. You have an older version of the cache. Click OK to download the new cache.", "Cache Version Invalid", JOptionPane.WARNING_MESSAGE);
    				}
            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 + "%");
                            }
                            System.out.println(localFileName + "\t" + numWritten);
                            drawLoadingText("Finished downloading "+getArchivedName()+"!");
                    } catch (Exception exception) {
                            exception.printStackTrace();
                    } finally {
                            try {
                                    if (in != null) {
                                            in.close();
                                    }
                                    if (out != null) {
                                            out.close();
                                    }
                            } catch (IOException ioe) {
                            }
                    }
    				fileExists();
            }
            private String getArchivedName() {
                    int lastSlashIndex = getCacheLink().lastIndexOf('/');
                    if (lastSlashIndex >= 0 
                            && lastSlashIndex < getCacheLink().length() -1) { 
                            return getCacheLink().substring(lastSlashIndex + 1);
                    } else {
                            System.err.println("error retreiving archivaed name.");
                    }
                    return "";
            }
    	public void fileExists() {
        File file=new File(localCacheFile());
        boolean exists = file.exists();
        if (!exists) {
          System.out.println("The cache was not downloaded correctly.");
    	  System.out.println("Please download it manually at:");
    	  System.out.println(localCacheFile());
    	  System.out.println("File Directory:");
    	  System.out.println(getCacheDir());
    	  pauseHandler();
    	cacheDownloadError();
        }else {
          drawLoadingText("Your cache is downloaded and ready to un-zip!");
    	  pauseHandler();
    	  unZip();	  
        }
    	}
    	        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());
                        }
    					drawLoadingText("[UN-ZIP]: " + e.getName());
                    }
                    zin.close();
                } catch(Exception e) {
                    e.printStackTrace();
                }
    			pauseHandler();
    			unNeededCacheExists();
            }
            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);
    				}
            }
    	public void unNeededCacheExists() {
        File file=new File(localCacheFile());
        boolean exists = file.exists();
        if (!exists) {
          System.out.println("Your cache was not downloaded correctly.");
    	  System.out.println("Please try to re re run the client.");
        }else {
          System.out.println("Your cache is on your HDD");
    	  System.out.println("Auto Cache Deleter Attempting to delete...");
    	  delete();	  
        }
    	}
    	    public void delete() {	
        	try{
        		File file = new File(localCacheFile());
        		if(file.delete()){
        			drawLoadingText("[SUCCESS]" +file.getName()+ " was deleted!");
    				System.out.println("[SUCCESS]" +file.getName()+ " was deleted!");
        		}else{
        			drawLoadingText("[ERROR]" +file.getName()+ " was not deleted.");
    				System.out.println("[ERROR]" +file.getName()+ " was not deleted.");
        		}
        	}catch(Exception e){
        		e.printStackTrace();
        	}
        }
    	public void cacheDownloadError() {
    		try {
                drawLoadingText("Cache Download Error - Contact an admin");
    			}
    			catch(Exception e){
        		e.printStackTrace();
        	}
    			}
      public void pauseHandler() {
         try {
           Thread.currentThread().sleep(pauseHandlerDelay1000Equals1Second());
           }
         catch (InterruptedException e) {
           e.printStackTrace();
           }
         }  
    }
    /*************************
    @author Google411
    *************************/
    Save, close, and compile!

    Just read the Header in CacheDownloader.java and the CONFIG aswell.
    You will get it theres no need to explain here.

    DONE
    Download CacheDownloader.java Below
    Paste.Rune-Server.org -
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    K4rn4ge's Bitch

    Join Date
    Jul 2010
    Posts
    1,609
    Thanks given
    149
    Thanks received
    128
    Rep Power
    48
    Thanks man, needed this. Mine has been fucking up repp'd
    Spoiler for People I Respect:
    Reply With Quote  
     

  4. #3  
    q.q


    Join Date
    Dec 2010
    Posts
    6,248
    Thanks given
    936
    Thanks received
    3,138
    Rep Power
    3552
    What's the difference between this and the cachedownloader already implemented in most clients?
    Reply With Quote  
     

  5. #4  
    The One And Only

    01053's Avatar
    Join Date
    Apr 2011
    Age
    19
    Posts
    2,024
    Thanks given
    326
    Thanks received
    532
    Rep Power
    231
    Quote Originally Posted by Harlan View Post
    What's the difference between this and the cachedownloader already implemented in most clients?
    What he said
    13/14H Siege Of Orgrimmar
    Reply With Quote  
     

  6. #5  
    K4rn4ge's Bitch

    Join Date
    Jul 2010
    Posts
    1,609
    Thanks given
    149
    Thanks received
    128
    Rep Power
    48
    I'm not sure about why, but i'm just saying i fucked mine up. So just using his.
    Spoiler for People I Respect:
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Jan 2010
    Posts
    466
    Thanks given
    263
    Thanks received
    77
    Rep Power
    43
    Heh, thanks for adding me to the credits.
    Reply With Quote  
     

  8. #7  
    Registered Member Xdragon's Avatar
    Join Date
    Apr 2010
    Age
    18
    Posts
    463
    Thanks given
    6
    Thanks received
    10
    Rep Power
    1
    Thanks i like the idea of it so now i dont need to change the cache name all the time to get the players new cache thanks bro
    also does it works on a webclient?

    EDIT:

    It doesnt work :

    And also when i changed something it didnt work like i changed color of the bank button but it didnt change
    Failure...
    Reply With Quote  
     

  9. #8  
    Google it ffs

    Reich's Avatar
    Join Date
    Mar 2011
    Age
    20
    Posts
    707
    Thanks given
    98
    Thanks received
    163
    Rep Power
    98
    Quote Originally Posted by Xdragon View Post
    Thanks i like the idea of it so now i dont need to change the cache name all the time to get the players new cache thanks bro
    also does it works on a webclient?

    EDIT:

    It doesn't work :

    And also when i changed something it didn't work like i changed color of the bank button but it didn't change
    Failure...
    Try getting rid of your thumbs.db in all folders in your cache then re uploading.
    I have a web server on my b0x so i just placed my cache into my htdocs folder then set my cache link to http://127.0.0.1/cache.zip. It makes troubleshooting a breeze
    That should work if not then you have right issues on your machine.
    The entire extraction will be shown in the loading bar of the client

    Also yes this does 100% work on any ProjectInsanity Galkons base Hard Client AND Web Client

    EDIT: Don't know if the V 1.2 is an issue or not but i siggest just sticking to single whole integers
    Reply With Quote  
     

  10. #9  
    Banned

    Join Date
    Oct 2010
    Posts
    1,309
    Thanks given
    63
    Thanks received
    258
    Rep Power
    0
    Thanks Needed this ! >.< Repped'
    Reply With Quote  
     

  11. #10  
    Hai der.

    Mr. Brightside's Avatar
    Join Date
    Oct 2008
    Age
    18
    Posts
    475
    Thanks given
    175
    Thanks received
    95
    Rep Power
    97
    Thanks for adding me to the credits

    Reply With Quote  
     

Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Fully working Crackers!
    By Cheese Smoke in forum Snippets
    Replies: 16
    Last Post: 11-16-2009, 05:54 AM
  2. Fully working map!!!!
    By Ichigo Kurosaki in forum Downloads
    Replies: 12
    Last Post: 08-20-2009, 07:17 AM
  3. [508] FULLY working G.E.! [508]
    By Pandemic Scape in forum Projects
    Replies: 66
    Last Post: 04-27-2009, 02:18 PM
  4. Replies: 66
    Last Post: 08-16-2008, 04:57 AM
  5. Fully Working 503 Compiler - 100% by me - JDK 4 And 5 working
    By Inspired Dreams in forum Configuration
    Replies: 4
    Last Post: 08-03-2008, 02:23 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
  •