Changeset 195 in tmcsimulator-scriptbuilder


Ignore:
Timestamp:
01/20/2020 08:06:39 PM (6 years ago)
Author:
sdanthin
Message:

SimulationScript?.java now prepends a zero if the number of the incident is less than 0, and starts incidents at index 1.
ScriptIncident?.java modified where the ID is set to accommodate for the above logic. see #222

Location:
trunk/src/scriptbuilder/structures
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/structures/ScriptIncident.java

    r168 r195  
    327327            if(((I_AudioEvent) ev).getID().equals("")) 
    328328            { 
    329                 ((I_AudioEvent) ev).setID(number+Integer.toString(audioEventCount)); 
    330329                audioEventCount++; 
     330                //ternary expression here just prepends an extra 0 to the ID of the audioEvent if its eventcount is less than 10 
     331                ((I_AudioEvent) ev).setID(number+((audioEventCount<10)? "0"+Integer.toString(audioEventCount):Integer.toString(audioEventCount))); 
     332                 
    331333            } 
    332334            if(t.getCorrespondingAudioEvent((I_AudioEvent)ev)==null) 
  • trunk/src/scriptbuilder/structures/SimulationScript.java

    r194 r195  
    7979    private MyScriptHandler sh; 
    8080     
     81    public final String audioDirectory = "Audio"; 
     82 
     83     
    8184    public boolean saved; 
    8285     
     
    275278    private void createAudioDirectory(Path path){ 
    276279        String separator = System.getProperty("file.separator"); 
    277         File f = new File(path.toString()+separator+"audio"); 
     280        File f = new File(path.toString()+separator+audioDirectory); 
    278281        if(!f.exists()) 
    279282        { 
     
    286289            { 
    287290                String name = ((Integer) i.number).toString(); 
    288                 File incidentFolder = new File(path.toString()+separator+"audio"+separator+name); 
     291                File incidentFolder = new File(path.toString()+separator+audioDirectory+separator+name); 
    289292                if(!incidentFolder.exists()) 
    290293                { 
     
    307310                            String output = radioEvent.toScriptFile(); 
    308311                            //optimally, this line should use the ID, but to account for files being read in, it needs to be the radiofile name 
     312                            System.out.println("Attempting to create file: "+ path.toString()+ 
     313                                            separator+ 
     314                                            audioDirectory+ 
     315                                            separator+ 
     316                                            name+ 
     317                                            separator+ 
     318                                            radioEvent.radioFile.replaceAll(".mp3","")+ 
     319                                            ".txt"); 
    309320                            File newAudioScript = new File( 
    310321                                    path.toString()+ 
    311322                                            separator+ 
    312                                             "Audio"+ 
     323                                            audioDirectory+ 
    313324                                            separator+ 
    314325                                            name+ 
Note: See TracChangeset for help on using the changeset viewer.