📄 enterqq.java
字号:
QQData qq=qqData.get(row-1);
qqData.set(row-1,qqData.get(row));
qqData.set(row,qq);
model.fireTableDataChanged();
table.setRowSelectionInterval(row-1,row-1);
upAndDownEnabled(row-1);
}
else if(o==down)
{
int row=table.getSelectedRow();
QQData qq=qqData.get(row+1);
qqData.set(row+1,qqData.get(row));
qqData.set(row,qq);
model.fireTableDataChanged();
table.setRowSelectionInterval(row+1,row+1);
upAndDownEnabled(row+1);
}
else if(o==option)
{
new OptionDialog(this);
}
else if(o==help)
{
new HelpDialog(this);
}
else if(o==exit)
{
saveOptions();
saveQQData();
System.exit(0);
}
else if(o==item[0])
{
int row=table.getSelectedRow();
QQData qq=qqData.get(row);
qq.setHide(!qq.isHide());
model.fireTableDataChanged();
}
else if(o==item[1])
{
int row=table.getSelectedRow();
qqData.remove(row);
model.fireTableDataChanged();
}
else if(o==item[2])
{
int row=table.getSelectedRow();
QQData qq=qqData.get(row);
StartQQ go=new StartQQ(options.getQQPath(),qq,options.getDelay());
go.start();
}
else if(o==item[3])
{
int row=table.getSelectedRow();
QQData qq=qqData.get(row);
StartQQ go=new StartQQ(options.getTMPath(),qq,options.getDelay());
go.start();
}
else if(o==item[4])
{
int row=table.getSelectedRow();
QQData qq=qqData.get(row);
StartQQ go=new StartQQ(options.getGamePath(),qq,options.getDelay());
go.start();
}
}
public void upAndDownEnabled(int row)
{
if(row==-1||table.getRowCount()<2)
{
up.setEnabled(false);
down.setEnabled(false);
}
else
{
if(row==0)
{
up.setEnabled(false);
down.setEnabled(true);
}
else if(row==table.getRowCount()-1)
{
up.setEnabled(true);
down.setEnabled(false);
}
else
{
up.setEnabled(true);
down.setEnabled(true);
}
}
}
public static void saveOptions()
{
try
{
if(options==null)
options=new Options();
DataOutputStream writer=new DataOutputStream(new FileOutputStream("QAL.ini"));
writer.writeUTF("QQ_PATH");
writer.writeUTF(options.getQQPath());
writer.writeUTF("TM_PATH");
writer.writeUTF(options.getTMPath());
writer.writeUTF("GAME_PATH");
writer.writeUTF(options.getGamePath());
writer.writeUTF("DELAY");
writer.writeInt(options.getDelay());
writer.writeUTF("ISCOLOSE");
writer.writeBoolean(options.isClose());
writer.writeUTF("ISCHECK");
writer.writeBoolean(options.isCheck());
writer.writeUTF("ISCODENEEDED");
writer.writeInt(options.isCodeNeeded()?1:0);
writer.flush();
writer.close();
}
catch(Exception ee)
{
KIT.beep();
JOptionPane.showMessageDialog(null,"QAL.ini文件保存失败!","错误信息",JOptionPane.ERROR_MESSAGE,WRONG);
System.exit(1);
}
}
public static Options loadOptions()
{
File setFile=new File("QAL.ini");
if(!setFile.exists())
{
return new Options();
}
Options result=new Options();
try
{
DataInputStream reader=new DataInputStream(new FileInputStream(setFile));
reader.readUTF();
result.setQQPath(reader.readUTF());
reader.readUTF();
result.setTMPath(reader.readUTF());
reader.readUTF();
result.setGamePath(reader.readUTF());
reader.readUTF();
result.setDelay(reader.readInt());
reader.readUTF();
result.setClose(reader.readBoolean());
reader.readUTF();
result.setCheck(reader.readBoolean());
reader.readUTF();
result.setCodeNeeded(reader.readInt()==1?true:false);
result.setSafeClose(true);
result.setCodeSave(true);
}
catch(Exception ee)
{
loadOptionsWrong();
}
return result;
}
public static void loadOptionsWrong()
{
KIT.beep();
int result=JOptionPane.showConfirmDialog(null,"QAL.ini文件内容已损坏,是否删除并重新创建?","警告信息",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE,WARNING);
if(result==JOptionPane.YES_OPTION)
{
saveOptions();
}
else
System.exit(1);
}
public static void saveQQData()
{
try
{
DataOutputStream output=new DataOutputStream(new FileOutputStream("LoginData.dat"));
output.writeUTF("QAL.ini");
byte[] bytes=password.getBytes();
output.writeInt(bytes.length);
for(byte b:bytes)
{
output.writeInt((int)b<<2);
output.writeDouble(Math.random()*10);
}
if(qqData==null)
output.writeInt(0);
else
{
output.writeInt(qqData.size());
for(int i=0;i<qqData.size();i++)
{
QQData data=(QQData)qqData.get(i);
output.writeInt(data.getType());
output.writeUTF(data.getName());
GregorianCalendar date=data.getDate();
output.writeInt(date.get(Calendar.YEAR));
output.writeInt(date.get(Calendar.MONTH)+1);
output.writeInt(date.get(Calendar.DAY_OF_MONTH));
byte[] codeByte=data.getCodeByte();
output.writeInt(codeByte.length);
output.write(codeByte);
output.writeInt(data.isHide()?1:0);
output.writeUTF(data.getNumber());
}
}
output.flush();
output.close();
}
catch(Exception ee)
{
ee.printStackTrace();
}
}
public Vector<QQData> loadQQData()
{
Vector<QQData> result=new Vector<QQData>(1,1);
File file=new File("LoginData.dat");
if(!file.exists())
{
KIT.beep();
JOptionPane.showMessageDialog(null,"您是第一次运行QQ自动登录器\n 请输入一个程序秘密","提示信息",JOptionPane.INFORMATION_MESSAGE,ICON);
CodeDialog dialog=new CodeDialog(this,x,y);
boolean selection=dialog.getState();
if(selection)
{
password=dialog.getNewCode();
saveQQData();
}
else
System.exit(0);
}
try
{
DataInputStream input=new DataInputStream(new FileInputStream("LoginData.dat"));
input.readUTF();
int length=input.readInt();
byte[] bytes=new byte[length];
for(int i=0;i<bytes.length;i++)
{
bytes[i]=(byte)(input.readInt()>>2);
input.readDouble();
}
password=new String(bytes);
length=input.readInt();
for(int i=0;i<length;i++)
{
int type=input.readInt();
String name=input.readUTF();
int year=input.readInt();
int month=input.readInt();
int day=input.readInt();
int codelength=input.readInt();
byte[] codeByte=new byte[codelength];
input.readFully(codeByte);
int hide=input.readInt();
String number=input.readUTF();
GregorianCalendar date=new GregorianCalendar(year,month-1,day);
QQData qq=new QQData(true,type,name,date,hide==1?true:false,number,codeByte);
result.add(qq);
}
}
catch(IOException ee)
{
KIT.beep();
int selection=JOptionPane.showConfirmDialog(null,"LoginData.dat文件内容已损坏,是否删除并重新创建?","警告信息",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.ERROR_MESSAGE,WARNING);
if(selection==JOptionPane.YES_OPTION)
{
CodeDialog dialog=new CodeDialog(this,x,y);
if(!dialog.getState())
System.exit(0);
saveQQData();
}
else
System.exit(1);
}
return result;
}
public static Vector<QQData> getQQData()
{
return qqData;
}
public static Options getOptions()
{
return options;
}
public static JButton getOptionButton()
{
return option;
}
public static JButton getStartButton()
{
return start;
}
public static QQTableModel getTableModel()
{
return model;
}
public static void main(String[] args)
{
EnterQQ qq=new EnterQQ();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -