?? database.java
字號:
// FrontEnd Plus GUI for JAD
// DeCompiled : Database.class
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
public class Database
{
private final int VIBRATION = 1;
private final int SOUND = 2;
private final int LIVELLO = 3;
private final int PUNTEGGIO = 4;
private final byte valori[] = {
70, 86, 70, 78, 68
};
private RecordStore rs;
Database()
{
rs = null;
}
private void openRecordStore()
throws RecordStoreException
{
if(rs == null)
rs = RecordStore.openRecordStore("Opzioni", true);
if(rs.getNumRecords() == 0)
{
byte b[] = {
86
};
rs.addRecord(b, 0, 1);
rs.addRecord(b, 0, 1);
byte c[] = {
70
};
rs.addRecord(c, 0, 1);
String pp = "0.0.0";
rs.addRecord(pp.getBytes(), 0, pp.length());
rs.addRecord(pp.getBytes(), 0, pp.length());
rs.addRecord(pp.getBytes(), 0, pp.length());
}
}
private void closeRecordStore()
throws RecordStoreException
{
if(rs != null)
{
rs.closeRecordStore();
rs = null;
}
}
boolean getUseVibration()
{
try
{
return getValue(1) == 86;
}
catch(Exception e)
{
return false;
}
}
boolean getUseSound()
{
try
{
return getValue(2) == 86;
}
catch(Exception e)
{
return false;
}
}
short leggiLivello()
{
try
{
byte v = getValue(3);
if(v == 70)
return 0;
if(v != 78) return 2; else return 1;
}
catch(Exception e)
{
return 0;
}
}
String leggiPunteggio(int l)
throws RecordStoreException
{
openRecordStore();
byte bytes[] = rs.getRecord(4 + l);
closeRecordStore();
return new String(bytes);
}
void setUseVibration(boolean bool)
{
int v = 0;
if(bool)
v = 1;
try
{
setValue(1, valori[v]);
}
catch(Exception e) { }
}
void setUseSound(boolean bool)
{
int v = 0;
if(bool)
v = 1;
try
{
setValue(2, valori[v]);
}
catch(Exception e) { }
}
void assegnaLivello(int livello)
{
try
{
setValue(3, valori[livello + 2]);
}
catch(Exception e) { }
}
void assegnaPunteggio(int l, String punteggio)
throws RecordStoreException
{
openRecordStore();
rs.setRecord(4 + l, punteggio.getBytes(), 0, punteggio.length());
closeRecordStore();
}
private void setValue(int id, byte b)
throws RecordStoreException
{
byte ba[] = new byte[1];
ba[0] = b;
openRecordStore();
rs.setRecord(id, ba, 0, 1);
closeRecordStore();
}
private byte getValue(int id)
throws RecordStoreException
{
openRecordStore();
byte barray[] = rs.getRecord(id);
closeRecordStore();
return barray[0];
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -