package script.bottom.check;
/*这个类用于检查存档列表*/

import java.io.File;

public class CheckSave {
	//预定义变量
	private static final Preset preset = new Preset();
	private static final String savePath = "./save/";
	private static final File savePathF = new File(savePath);
	
	//这个类用于获取存档列表
	public String[] saveList(){
		preset.creatorSave();
		return savePathF.list();
	}
	
	//这个类用于检查存档数量
	public int checkSaveN(){
		int judge;
		String[] saveList = savePathF.list();
		if(saveList.length <= 9){
			judge = 0;
		}else{
			judge = 1;
		}
		return judge;
	}
	
	//这个类用于检查存档是否已被创建
    public int checkSaveL(String saveName){
		int judge;
		File saveF = new File(savePath + saveName);
		if(saveF.exists() && saveF.isDirectory()){
			judge = 1;
		}else{
			judge = 0;
		}
		return judge;
	}

	//这个类用于删除存档
	public void removeSave(String saveName){
		File saveF = new File(savePath + saveName);
		if(saveF.exists()){
			saveF.delete();
		}else{
			return;
		}
	}
	
}