Examples of VPKArchive


Examples of info.ata4.vpk.VPKArchive

    }

    private VPKEntry getMusicScriptFile(String fileName)
    {
        File vpkFile = new File(vpkPath);
        VPKArchive vpk = new VPKArchive();
        VPKEntry entryToReturn = null;
        try
        {
            vpk.load(vpkFile);
        }
        catch (Exception ex)
        {
            System.err.println("Can't open VPK Archive. Details: " + ex.getMessage());
            return entryToReturn;
        }

        String fn = fileName.replace("\\", "/"); //jVPKLib only uses forward slashes in paths.
        return vpk.getEntry(fn);
    }
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

            //First go in and delete the sound in customSounds  
            deleteSoundFileByWaveString(selectedWaveString);

            //Get the relevant wavestring from the internal scriptfile                   
            VPKArchive vpk = new VPKArchive();
            try
            {
                vpk.load(new File(this.vpkPath));
            }
            catch (IOException ex)
            {
                ex.printStackTrace();
            }
            String scriptDir = ((NamedMusic) currentDropdown.getSelectedItem()).getFilePath().toString();
            scriptDir = scriptDir.replace("\\", "/");

            byte[] bytes = null;
            VPKEntry entry = vpk.getEntry(scriptDir);
            try
            {
                ByteBuffer scriptBuffer = null;
                scriptBuffer = entry.getData();
                bytes = new byte[scriptBuffer.remaining()];
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

        vpkSearchPaths.add("scripts/music/");
        vpkSearchPaths.add("scripts/music/terrorblade_arcana/");
        vpkSearchPaths.add("scripts/music/valve_dota_001/");
        vpkSearchPaths.add("scripts/music/valve_ti4/");
        File file = new File(vpkPath);
        VPKArchive vpk = new VPKArchive();

        try
        {
            vpk.load(file);
        }
        catch (Exception ex)
        {
            System.err.println("Can't open archive: " + ex.getMessage());
            return;
        }

        for (String dir : vpkSearchPaths)
        {
            for (VPKEntry entry : vpk.getEntriesForDir(dir))
            {
                //TODO: Replace this with a (user-editable?) list of paths to search read in from a file(?)
                if (entry.getPath().contains("game_sounds_music.txt")
                        || entry.getPath().contains("game_sounds_music_int.txt")
                        || entry.getPath().contains("game_sounds_music_spectator.txt")
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

        {
            return null;
        }

        File file = new File(vpkPath);
        VPKArchive vpk = new VPKArchive();
        File entryFile = new File("");

        String waveSubstring = "";
        int startIndex = -1;
        int endIndex = -1;
        if (waveString.contains("\"wave\""))
        {
            startIndex = Utility.nthOccurrence(waveString, '\"', 2);
            endIndex = Utility.nthOccurrence(waveString, '\"', 3);
        }
        //For weird special cases where the "wave" part of the string is missing, i.e. Treant's Overgrowth.Target spell
        else
        {
            startIndex = Utility.nthOccurrence(waveString, '\"', 0);
            endIndex = Utility.nthOccurrence(waveString, '\"', 1);
        }

        waveSubstring = waveString.substring(startIndex, endIndex + 1);
        waveSubstring = waveSubstring.replace(")", "");
        waveSubstring = waveSubstring.replace("\"", "");
        waveSubstring = waveSubstring.replace("\\", "/");
        waveSubstring = waveSubstring.replace("#", "");
        waveSubstring = waveSubstring.replace("*", "");

        if (!waveString.contains("custom"))
        {
            File localFile = new File(Paths.get(installDir + "/sound/" + waveSubstring).toString());
            if (localFile.isFile())
            {
                return localFile;
            }

            try
            {
                vpk.load(file);
            }
            catch (Exception ex)
            {
                System.err.println("Can't open archive: " + ex.getMessage());
            }
            waveSubstring = "sound/" + waveSubstring;
            VPKEntry entry = vpk.getEntry(waveSubstring.toLowerCase());

            entryFile = entry.getType().contains("wav")
                    ? new File(Paths.get(System.getProperty("user.dir") + "/scratch/scratch.wav").toString())
                    : new File(Paths.get(System.getProperty("user.dir") + "/scratch/scratch.mp3").toString());

View Full Code Here

Examples of info.ata4.vpk.VPKArchive

    }
   
    public void buildHeroPortraits()
    {
        File file = new File(fileName);
        VPKArchive vpk = new VPKArchive();                     

        try
        {
            vpk.load(file);
        }
        catch (Exception ex)
        {
            System.err.println("Can't open archive: " + ex.getMessage());
            return;
        }

        BufferedImage image = null;
        for (VPKEntry entry : vpk.getEntries())
        {
            //Put criteria to search for here
            if (entry.getPath().contains("resource/flash3/images/heroes/") && entry.getType().equals("png")
                    && !(entry.getPath().contains("selection")))
            {
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

    }       

    public void buildItemPortraits()
    {
        File file = new File(fileName);
        VPKArchive vpk = new VPKArchive();                      

        try
        {
            vpk.load(file);
        }
        catch (Exception ex)
        {
            System.err.println("Can't open archive: " + ex.getMessage());
            return;
        }

        BufferedImage image = null;
        for (VPKEntry entry : vpk.getEntries())
        {
            //Put criteria to search for here
            if (entry.getPath().contains("resource/flash3/images/items/") && entry.getType().equals("png"))    
            {
                File imageFile = new File(entry.getPath());
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

        if (sessionCrcs.containsKey(scriptKey + SESSION_CRC_SEP))
        {
            return sessionCrcs.get(scriptKey + SESSION_CRC_SEP);
        }
        String vpkPath = UserPrefs.getInstance().getVPKPath();
        VPKArchive vpk = new VPKArchive();
        long internalCrc = 0;
        try
        {
            vpk.load(new File(vpkPath));
            String scriptPath = scriptsProperties.getProperty(scriptKey + PATH_SEP);
            VPKEntry scriptEntry = vpk.getEntry(scriptPath);
            if (scriptEntry != null)
            {
                internalCrc = scriptEntry.getCRC32();
            }
            else
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

    private VPKEntry getItemScriptFile(String nop)
    {
        String internalScriptPath = "scripts/game_sounds_items.txt";
        File vpkFile = new File(vpkPath);
        VPKArchive vpk = new VPKArchive();
        try
        {
            vpk.load(vpkFile);
        }
        catch (Exception ex)
        {
            JOptionPane.showMessageDialog(this,
                    "Error: Unable to open VPK file.\nDetails: " + ex.getMessage(),
                    "Error opening VPK", JOptionPane.ERROR_MESSAGE);
            ex.printStackTrace();
            return null;
        }

        VPKEntry entry = vpk.getEntry(internalScriptPath);
        return entry;
    }
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

            //First go in and delete the sound in customSounds  
            deleteSoundFileByWaveString(selectedWaveString);

            //Get the relevant wavestring from the internal scriptfile                   
            VPKArchive vpk = new VPKArchive();
            try
            {
                vpk.load(new File(this.vpkPath));
            }
            catch (IOException ex)
            {
                ex.printStackTrace();
            }
            String scriptDir = this.getCurrentScriptString();
            scriptDir = scriptDir.replace(Paths.get(installDir, "/dota/").toString(), "");
            scriptDir = scriptDir.replace("\\", "/");                           //Match internal forward slashes
            scriptDir = scriptDir.substring(1);                                 //Cut off leading slash
            scriptDir = scriptDir.substring(0, scriptDir.lastIndexOf("/") + 1); //Cut off file extension           

            String scriptFileString = null;
            byte[] bytes = null;
            for (VPKEntry entry : vpk.getEntriesForDir(scriptDir))
            {
                if (entry.getName().contains("game_sounds_items"))
                {
                    try
                    {
View Full Code Here

Examples of info.ata4.vpk.VPKArchive

    {
        currentDropdown.removeAllItems();
        Set heroList = new CopyOnWriteArraySet();
        //Build list of heroes and populate dropwdown with it               
        File file = new File(vpkPath);
        VPKArchive vpk = new VPKArchive();

        System.out.println(file);

        try
        {
            vpk.load(file);
        }
        catch (Exception ex)
        {
            System.err.println("Can't open archive: " + ex.getMessage());
            return;
        }

        for (VPKEntry entry : vpk.getEntries())
        {
            if (entry.getPath().contains("scripts/game_sounds_heroes/"))
            {
                heroList.add(entry.getName());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.