Package info.ata4.unity.cli.cmd

Examples of info.ata4.unity.cli.cmd.InfoCmd


        {
            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


    }
   
    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

    }       

    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

        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

    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

            //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

    {
        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

    private VPKEntry getHeroScriptFile(String heroName)
    {
        heroName = heroName.toLowerCase();
        String internalScriptPath = "scripts/game_sounds_heroes/game_sounds_" + heroName + ".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

            //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.getScriptPathByHeroName(((NamedHero) currentDropdown.getSelectedItem()).getInternalName());
            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_" + ((NamedHero) currentDropdown.getSelectedItem()).getInternalName()))
                {
                    try
                    {
View Full Code Here

        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

TOP

Related Classes of info.ata4.unity.cli.cmd.InfoCmd

Copyright © 2018 www.massapicom. 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.