📄 fbrecordstore.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: FbRecordStore.java
package com.sonyericsson.fb.utils;
import javax.microedition.rms.*;
import se.southend.drops.screen.Device;
// Referenced classes of package com.sonyericsson.fb.utils:
// Logger
public class FbRecordStore
{
public FbRecordStore()
{
mSessionStore = null;
}
public void open(boolean isRecordStoreOwner)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
{
if(isRecordStoreOwner)
{
mSessionStore = RecordStore.openRecordStore("FB_SESSION_STORE", true, 1, true);
byte empty[] = (new String("")).getBytes();
for(int i = mSessionStore.getNumRecords(); i < 7; i++)
if(i == 3)
mSessionStore.addRecord(String.valueOf(0).getBytes(), 0, String.valueOf(0).getBytes().length);
else
if(i == 4)
{
String defaultUpdateSchedule = Device.getProperty("Facebook-Default-Update-Interval");
if(defaultUpdateSchedule == null || defaultUpdateSchedule.length() == 0)
defaultUpdateSchedule = "0";
mSessionStore.addRecord(defaultUpdateSchedule.getBytes(), 0, defaultUpdateSchedule.getBytes().length);
} else
if(i == 5)
{
String tickerEnabled = Device.getProperty("Facebook-Standby-Ticker-Enabled");
if(tickerEnabled == null || tickerEnabled.length() == 0)
tickerEnabled = "0";
mSessionStore.addRecord(tickerEnabled.getBytes(), 0, tickerEnabled.getBytes().length);
} else
{
mSessionStore.addRecord(empty, 0, empty.length);
}
} else
{
mSessionStore = RecordStore.openRecordStore("FB_SESSION_STORE", "SonyEricsson", "Facebook");
}
}
public byte[] getRecord(int recordId)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
{
if(mSessionStore == null)
throw new RecordStoreNotOpenException();
byte result[] = mSessionStore.getRecord(recordId);
if(result == null)
result = (new String("")).getBytes();
return result;
}
public String getUid()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
{
return new String(getRecord(1));
}
public String getSessionKey()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
{
return new String(getRecord(2));
}
public String getSessionSecret()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
{
return new String(getRecord(3));
}
public int getExpiry()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, NumberFormatException
{
return Integer.parseInt(new String(getRecord(4)));
}
public int getUpdateScheduleOption()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, NumberFormatException
{
return Integer.parseInt(new String(getRecord(5)));
}
public int getIsStandbyTickerEnabled()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, NumberFormatException
{
return Integer.parseInt(new String(getRecord(6)));
}
public boolean getShowLoginDisclaimer()
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, NumberFormatException
{
return (new String(getRecord(7))).compareTo("0") != 0;
}
public void setRecord(int recordId, byte bytes[])
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
if(mSessionStore == null)
{
throw new RecordStoreNotOpenException();
} else
{
mSessionStore.setRecord(recordId, bytes, 0, bytes.length);
return;
}
}
public void setUid(String uid)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(1, uid.getBytes());
}
public void setSessionKey(String key)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(2, key.getBytes());
}
public void setSessionSecret(String secret)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(3, secret.getBytes());
}
public void setExpiry(int expiry)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(4, String.valueOf(expiry).getBytes());
}
public void setUpdateScheduleOption(int option)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(5, String.valueOf(option).getBytes());
}
public void setStandbyTickerEnabled(int enabled)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(6, String.valueOf(enabled).getBytes());
}
public void setShowLoginDisclaimer(boolean show)
throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException, RecordStoreFullException
{
setRecord(7, String.valueOf(show ? 1 : 0).getBytes());
}
public void close()
{
if(mSessionStore != null)
try
{
mSessionStore.closeRecordStore();
}
catch(RecordStoreNotOpenException e)
{
Logger.printErrorln("Record store not open! " + e.toString());
}
catch(RecordStoreException e)
{
Logger.printErrorln("Record store generated an exception! " + e.toString());
}
mSessionStore = null;
}
public long getUpdateScheduleInSeconds()
{
int option = getUpdateScheduleOption();
if(option >= 0 && option < updateScheduleSeconds.length)
return updateScheduleSeconds[option];
break MISSING_BLOCK_LABEL_52;
Exception e;
e;
Logger.printErrorln("Got exception in getUpdateScheduleInSeconds! " + e.toString());
return 0L;
}
public static boolean getIsStandbyTickerEnabledNoThrow(boolean isRecordStoreOwner)
{
boolean retVal;
FbRecordStore rs;
retVal = false;
rs = new FbRecordStore();
rs.open(isRecordStoreOwner);
retVal = rs.getIsStandbyTickerEnabled() == 1;
Exception e;
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
e.printStackTrace();
}
break MISSING_BLOCK_LABEL_83;
e;
e.printStackTrace();
try
{
rs.close();
}
// Misplaced declaration of an exception variable
catch(Exception e)
{
e.printStackTrace();
}
break MISSING_BLOCK_LABEL_83;
Exception exception;
exception;
try
{
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
throw exception;
return retVal;
}
private static final String RS_OWNER_VENDOR_NAME = "SonyEricsson";
private static final String RS_OWNER_MIDLET_NAME = "Facebook";
private static final String SESSION_STORE = "FB_SESSION_STORE";
private static final int UID_RECORD = 1;
private static final int SESSION_KEY_RECORD = 2;
private static final int SESSION_SECRET_RECORD = 3;
private static final int EXPIRY_RECORD = 4;
private static final int UPDATE_SCHEDULE_RECORD = 5;
private static final int STANDBY_TICKER_ENABLED_RECORD = 6;
private static final int SHOW_LOGIN_DISCLAIMER_RECORD = 7;
private static final int LAST_RECORD = 7;
private static final long updateScheduleSeconds[] = {
900L, 3600L, 21600L, 0x15180L, 0L
};
private RecordStore mSessionStore;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -