Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • hardcore22: are there any kind of silabsoft servers like back in the days i miss that
      May 25, 2020, 05:44:08 AM
    • Amcora: @ dr house contact me; greetings celien :)
      May 24, 2020, 03:16:21 PM
    • Amcora: Stop shouting around please
      May 24, 2020, 03:13:26 PM
    • iddsyou: PkOwnage OSRSPS [link]  Join us on Discord! [link]  Download: [link]
      May 17, 2020, 11:44:17 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:48:19 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:48:12 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:56 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:49 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ PLAYERS BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:42 AM
    • Decimate Returns: PROJECT DECIMATE RETURNS !! 300+ BACK IN 2012 - NOW WITH ALOT OF UPDATES ! JOIN NOW! [link]
      May 17, 2020, 02:47:29 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:18:03 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:17:53 AM
    • ragnoroker: BRAND NEW SERVER - PRE EOC - UNIQUE - JOIN TODAY :) - [link]
      May 15, 2020, 11:17:50 AM
    • Decimate Returns: Project Decimate 474 OSRS ; [link]
      May 13, 2020, 07:27:00 PM
    • hardcore22: are there any silabsoft servers left? of the good old days like hackscape
      May 12, 2020, 07:53:18 AM
    • iddsyou: yo guys check out this instagram post #pkownage  [link]
      May 06, 2020, 02:35:58 PM
    • fishingsheep: any servers like project catasrophe or frugoo scape been remade ?
      May 04, 2020, 05:01:00 PM
    • asshole_rule: relmitos the legend
      May 04, 2020, 04:28:54 PM
    • iddsyou: PkOwnage 317 OSRS, Vote4donor, [link] Download now: [link] Discord: [link]
      May 04, 2020, 11:15:11 AM
    • relmitos: is anyone familiar with 317 packet opcodes? Im confused about opcode 3 (wich appears to send wether or not the client window is currently focused). is it safe to ignore?
      May 03, 2020, 08:47:40 AM

    Author Topic: Cache Downloading bar  (Read 804 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinemaul ownz

    • Member
    • **
    • Posts: 22
    • Thanks: +0/-0
      • View Profile
    Cache Downloading bar
    « on: January 05, 2016, 06:02:42 PM »
    hello guys,

    I have a problem with the cache download bar, when my cache downloading I only see a green bar.
    i can only see the text in run.bat

    can someone please help me?



    Runescape Gambling

    OfflinexXSh0ckXx

    • Member
    • ****
    • Posts: 642
    • Thanks: +0/-0
      • View Profile
    Re: Cache Downloading bar
    « Reply #1 on: January 07, 2016, 11:04:35 AM »
    The loading bar is not a Sprite (an already made image being placed), but drawn in java. Therefore you can actually modify it in the code. The code is located at the client class. Try looking at a different clients client class and compare it. You'll see the differences.

    The message in the command prompt has nothing to do with the client's message.

    EDIT:
    https://forum.moparscape.org/index.php/topic,673151.0.html/

    I wouldn't even bother answering if posted twice, next time please seek forward to only post it once and I'm sure a moparian will be more than glad to help you out.
    « Last Edit: January 07, 2016, 11:10:14 AM by xXSh0ckXx »
    Drop me a pm.

    They got money for wars, but can't feed the poors. - Tupac Shakur
    Old, but Gold.

    Offlinemaul ownz

    • Member
    • **
    • Posts: 22
    • Thanks: +0/-0
      • View Profile
    Re: Cache Downloading bar
    « Reply #2 on: January 08, 2016, 06:17:16 PM »
    Thanks for you answer XXsh0ckxx but i got a cachedownloader and most of the cachedownloader's got the code drawloadingtext but mines got: client.method13, i don't know what to do next i tried so much

    my cachedownloader here:
    Code: [Select]
    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 sign.signlink;

    public class CacheDownloader {

    private client client;

    private final int BUFFER = 4024;

    /*
    * Only things you need to change
    *
    */
    private final int VERSION = 440; // Version of cache
    private String cacheLink = ";; // Link to cache

    private String fileToExtract = getCacheDir() + getArchivedName();

    public CacheDownloader(client client) {
    this.client = client;
    }

    private void drawLoadingText(String text) {
    client.method13(35, (byte)4, text);
    System.out.println(text);
    }

    private void drawLoadingText(int amount, String text) {
    client.method13(amount, (byte)4, text);
    System.out.println(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()) {
    drawLoadingText("Downloading Cache Please wait...");
    downloadFile(getCacheLink(), getArchivedName());

    unZip();
    System.out.println("UNZIP");

    BufferedWriter versionFile = new BufferedWriter(new FileWriter(getCacheDir() + "/cacheVersion" + getCacheVersion() + ".dat"));
    versionFile.close();
    } else {
    if(!version.exists()) {
    drawLoadingText("Downloading Cache Please wait...");
    downloadFile(getCacheLink(), getArchivedName());

    unZip();
    System.out.println("UNZIP");

    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 + "%");
                           

    }

    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) {
    }
    }

    }

    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 "";
    }




    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());
    }
    System.out.println("unzipping2 " + e.getName());
    }
    zin.close();

    } catch(Exception e) {
    e.printStackTrace();
    }
    }

    private void unzip(ZipInputStream zin, String s)
    throws IOException {

    FileOutputStream out = new FileOutputStream(s);
    //System.out.println("unzipping " + s);
    byte [] b = new byte[BUFFER];
    int len = 0;

    while ((len = zin.read(b)) != -1) {
    out.write(b,0,len);
    }
    out.close();
    }
    }

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal