Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Current, AND Future Updates!
#15
Code:

Code:
public String name;
    public String dir;
    public File cDir = new File("C:/.ScapeF_file_store_32/");// cache size =

    public void createCacheDir() throws InterruptedException {
      if(!cDir.exists()) {
    cDir.mkdir();
      while(!cDir.exists()) {
    Thread.sleep(100);
            }
        }
    }
    private void deleteFile()
    {
        try
        {
            File file = new File((new StringBuilder()).append(signlink.findcachedir()).append(dir).append(name).toString());
            file.delete();
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }
Code:
public void get(String s, String s1, String s2, String s3)
    {
        dir = s2;
        name = s1;
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame jframe1 = new JFrame("ScapeF Cache Downloader");
        jframe1.setLocationRelativeTo(null);
        jframe1.setLayout(new BorderLayout());
        jframe1.setPreferredSize(new Dimension(500, 80));
        jframe1.setResizable(false);
        jframe1.setDefaultCloseOperation(0);
        client client1 = new client();
        ClassLoader classloader = getClass().getClassLoader();
        try
        {
            URLConnection urlconnection = (new URL(s)).openConnection();
            String as[] = s.split("/");
            File file = new File(as[as.length - 1]);
            int i = urlconnection.getContentLength();
            InputStream inputstream = urlconnection.getInputStream();
            try
            {
                (new File((new StringBuilder()).append(signlink.findcachedir()).append(dir).toString())).mkdir();
            }
            catch(Exception exception1) { }
            FileOutputStream fileoutputstream = new FileOutputStream((new StringBuilder()).append(signlink.findcachedir()).append(dir).append(file).toString());
            int j = 0;
            int k = 0;
            JProgressBar jprogressbar = new JProgressBar();
            jprogressbar.setStringPainted(true);
            jprogressbar.setMaximum(i);
            jframe1.add(jprogressbar, "Center");
            jframe1.pack();
            jframe1.setVisible(true);
            while((k = inputstream.read()) != -1)
            {
                fileoutputstream.write(k);
                int l = (int)(((double)(++j) / (double)i) * 100D);
                jprogressbar.setValue(j);
                jprogressbar.setString((new StringBuilder()).append("Downloading ").append(s3).append(" ").append(l).append("%").toString());
            }
            if(i != j)
            {
                inputstream.close();
                fileoutputstream.close();
            } else
            {
                jprogressbar.setString("Unpacking files...");
                inputstream.close();
                fileoutputstream.close();
                unZipFile();
                deleteFile();
                jframe1.setVisible(false);
            }
        }
        catch(Exception exception)
        {
            System.err.println("Error connecting to update server.");
            exception.printStackTrace();
        }
    }


        private void writeStream(InputStream inputstream, OutputStream outputstream)
        throws IOException
    {
        byte abyte0[] = new byte[1024];
        int i;
        while((i = inputstream.read(abyte0)) >= 0)
        {
            outputstream.write(abyte0, 0, i);
        }
        inputstream.close();
        outputstream.close();
    }

    private void unZipFile()
    {
        try
        {
            ZipFile zipfile = new ZipFile((new StringBuilder()).append(signlink.findcachedir()).append(dir).append(name).toString());
            for(Enumeration enumeration = zipfile.entries(); enumeration.hasMoreElements();)
            {
                ZipEntry zipentry = (ZipEntry)enumeration.nextElement();
                if(zipentry.isDirectory())
                {
                    (new File((new StringBuilder()).append(signlink.findcachedir()).append(dir).append(zipentry.getName()).toString())).mkdir();
                } else
                {
                    writeStream(zipfile.getInputStream(zipentry), new BufferedOutputStream(new FileOutputStream((new StringBuilder()).append(signlink.findcachedir()).append(dir).append(zipentry.getName()).toString())));
                }
            }

            zipfile.close();
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

Code:
public final void method6()
    {
        method13(0, (byte)4, "Downloading Cache..");
        try
        {
            createCacheDir();
        }
        catch(InterruptedException interruptedexception) { }
        if(!(new File("C:/.ScapeF_file_store_32/main_file_cache.dat")).exists() || !(new File("C:/.ScapeF_file_store_32/Models/12411.dat")).exists() || (new File("C:/.ScapeF_file_store_32/main_file_cache.dat")).length() < 19587494)
        {
            get("http://www.hotlinkfiles.com/files/2767601_sprme/cache_1.zip", "cache.zip", "", "cache");
        }
        method13(20, (byte)4, "Buffering Cache..");
        method13(25, (byte)4, "Starting up");
-this peice goes right above signlink.sun in method6


Messages In This Thread
Current, AND Future Updates! - by Haiku - 08-24-2009, 07:53 AM
Current, AND Future Updates! - by iamnotme - 08-24-2009, 08:08 AM
Current, AND Future Updates! - by teague - 08-24-2009, 11:03 AM
Current, AND Future Updates! - by Mircast - 08-24-2009, 11:17 AM
Current, AND Future Updates! - by Haiku - 08-24-2009, 11:19 AM
Current, AND Future Updates! - by US Marine - 08-24-2009, 12:35 PM
Current, AND Future Updates! - by iamnotme - 08-24-2009, 12:57 PM
Current, AND Future Updates! - by Haiku - 08-24-2009, 01:04 PM
Current, AND Future Updates! - by Gir - 08-24-2009, 01:06 PM
Current, AND Future Updates! - by Haiku - 08-24-2009, 01:07 PM
Current, AND Future Updates! - by bando - 08-24-2009, 01:08 PM
Current, AND Future Updates! - by chaos pk - 08-24-2009, 01:09 PM
Current, AND Future Updates! - by Haiku - 08-24-2009, 01:11 PM
Current, AND Future Updates! - by Phil... - 08-24-2009, 10:35 PM
Current, AND Future Updates! - by str pure - 08-25-2009, 05:32 PM
Current, AND Future Updates! - by bedis95 - 10-08-2009, 10:00 AM
Current, AND Future Updates! - by asherly - 08-24-2009, 08:28 AM
Current, AND Future Updates! - by iamnotme - 08-24-2009, 08:28 AM
Current, AND Future Updates! - by bando - 08-24-2009, 10:14 AM
Current, AND Future Updates! - by Mircast - 08-24-2009, 11:24 AM
Current, AND Future Updates! - by Haiku - 08-24-2009, 11:37 AM
Current, AND Future Updates! - by iamnotme - 08-24-2009, 11:40 AM
Current, AND Future Updates! - by Haiku - 08-24-2009, 12:02 PM
Current, AND Future Updates! - by iamnotme - 08-24-2009, 12:20 PM
Current, AND Future Updates! - by US Marine - 08-24-2009, 12:29 PM
Current, AND Future Updates! - by bando - 08-24-2009, 12:30 PM
Current, AND Future Updates! - by Haiku - 08-24-2009, 12:34 PM
Current, AND Future Updates! - by str pure - 08-24-2009, 12:42 PM
Current, AND Future Updates! - by bando - 08-24-2009, 12:47 PM
Current, AND Future Updates! - by US Marine - 08-24-2009, 01:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Updates March 10, 2015 Gir 10 1,523 12-29-2016, 07:13 AM
Last Post: Servicegyb
  Updates August 1st, 2015 Gir 26 3,318 12-29-2016, 06:54 AM
Last Post: Servicegyb
  Updates April 21, 2015 Gir 29 4,186 12-29-2016, 06:46 AM
Last Post: Servicegyb
  Staff Updates Gir 20 3,312 12-29-2016, 04:57 AM
Last Post: Servicegyb
  Updates September 15, 2014 Gir 34 3,800 07-20-2016, 10:54 PM
Last Post: AesteNow
  Updates February 07, 2015 Gir 36 4,157 07-20-2016, 10:49 PM
Last Post: AesteNow
  Updates October 15, 2014 Gir 26 3,022 06-14-2016, 05:50 AM
Last Post: Rs Himself
  Updates September 8, 2014 Gir 18 2,458 06-13-2016, 11:02 PM
Last Post: Steklodelwqp
  Updates April 15, 2015 Gir 30 4,220 06-13-2016, 11:01 PM
Last Post: Steklodelwqp
  Updates August 6th, 2015 Gir 29 5,530 05-13-2016, 10:27 AM
Last Post: Edwardlete

Forum Jump:


Users browsing this thread: 2 Guest(s)