//限制次数
public static void xzsoft()throws IOException
{
File f =new File("countxz.ini");
Properties prop =new Properties();
if (!f.exists())
{
f.createNewFile();
}
FileInputStream fis =new FileInputStream(f);
prop.load(fis);
int num =0;
String value =prop.getProperty("time");
if (!(value==null))
{
num=Integer.parseInt(value);
if (num>=5)
{
sop("次数已到");
return ;
}
}
num++;
prop.setProperty("time",num+"");
FileOutputStream fos =new FileOutputStream(f);
prop.store(fos,"#comments:");
prop.list(System.out);
fis.close();
fos.close();
} |
|