package turgen.plugin.plturbo;
import java.io.File;
import turgen.Turgen;

import turgen.dtb.DOS2Binary;
import turgen.generator.PulseCrate;

import turgen.playlist.AbstractPlayListItem;
import turgen.plugin.BinaryConvertor;
import turgen.plugin.Plugin;


public class PlLowerSilesiaTurbo2000AutoTurboBinaryConvertor implements BinaryConvertor {

    private Plugin plugin;

    public PlLowerSilesiaTurbo2000AutoTurboBinaryConvertor(PlLowerSilesiaTurbo2000Plugin p) {
        this.plugin=p;
    }


    public boolean acceptsBinary(DOS2Binary bf) {
       if (bf.hasInitSegment()==true) return false;
       return true;
    }

    public int getPilotToneCount(DOS2Binary bf) {
        return 2;
    }

    public String getDescription() {
        return "Lower Silesia Turbo 2000 - Auto Turbo";
    }

    public boolean hasLoader() {
        return true;
    }

    public AbstractPlayListItem getPlaylistItem(DOS2Binary bf, String inFile, String outFile,PulseCrate speed) {
        
        File f = new File(inFile);
        String sName = f.getName();
        if (sName.length()>10) sName=sName.substring(0,10);
        PlLowerSilesiaTurbo2000PlaylistItem pi = new PlLowerSilesiaTurbo2000PlaylistItem(inFile, outFile, speed, sName, PlLowerSilesiaTurbo2000PlaylistItem.CV_BINARY_AUTOTURBO, new int[0]);
        pi.pluginClass=Turgen.pluginManager.getPluginClassName(plugin);
        return pi;
        

    }

    public PulseCrate[] getSpeeds(int recorderModification) {
            return Turgen.pulseCache.getPulsesForPlugin(plugin.getClass().getName());
    }

     public boolean acceptsRecorderModification(int recorderModification) {

        /*Lower Silesia Turbo 2000*/
        if (recorderModification==BinaryConvertor.REC_MOD_PL_LOWER_SILESIA_2000) return true;
        /*Ohters are not*/
        return false;


    }

    public boolean exhaustsRecorderModification(int recorderModification) {

        /*Turbo 2000 is exhausted always*/
        if (recorderModification==REC_MOD_PL_LOWER_SILESIA_2000) return true;
        /*Ohters are not*/
        return false;

    }

    public boolean requiresPulses() {
        return true;
    }


}
