d.java
来自「用J2ME开发的一个类似于帝国游戏的小游戏软件。」· Java 代码 · 共 250 行
JAVA
250 行
// 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) fieldsfirst ansi
import java.io.IOException;
import javax.microedition.io.Connection;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
public final class d
implements Runnable
{
private String b;
private String c;
private static d d;
private String e[];
private String f;
private String g;
private short h;
private short i;
public byte a;
private byte j;
private d()
{
b();
}
public static final d a()
{
if(d == null)
d = new d();
else
d.b();
return d;
}
public final void b()
{
b = null;
c = null;
a = 1;
if(e != null)
{
for(int k = 0; k < e.length; k++)
e[k] = null;
e = null;
}
g = null;
f = null;
h = 0;
j = 0;
}
public final synchronized void a(String s, String s1)
{
a.a(s != null && !s.equals(""), "address format error!");
a.a(s1 != null && !s1.equals(""), "message format error!");
a.a("[SMS] Address: " + s);
b = "sms://" + s;
a.a("[SMS] " + s1);
c = s1;
}
public final synchronized void a(String as[], int k, String s, String s1)
{
a.a(as != null, "prompt string error!");
e = as;
i = (short)k;
h = (short)k;
f = s;
g = s1;
}
public final byte a(boolean flag, boolean flag1)
{
j++;
if(j < 0)
j = 0;
switch(a)
{
default:
break;
case 1: // '\001'
if(j % 2 >= 1)
h -= 8;
if(flag)
{
a = 2;
Thread thread;
(thread = new Thread(this)).start();
break;
}
if(flag1)
a = 5;
break;
case 2: // '\002'
try
{
Thread.sleep(200L);
}
catch(InterruptedException _ex) { }
break;
case 3: // '\003'
if(flag)
return 1;
break;
case 4: // '\004'
if(flag)
return 2;
break;
case 5: // '\005'
return 3;
}
return 0;
}
public final void run()
{
MessageConnection messageconnection = null;
TextMessage textmessage;
(textmessage = (TextMessage)(messageconnection = (MessageConnection)Connector.open(b)).newMessage("text")).setPayloadText(c);
messageconnection.send(textmessage);
a = 3;
a.a("[SMS] SMS send successfully :)");
if(messageconnection != null)
try
{
messageconnection.close();
}
catch(IOException _ex)
{
a.a("[SMS] Close SMS connection error caught!");
}
return;
JVM INSTR pop ;
a = 4;
a.a("[SMS] SMS send error!");
if(messageconnection != null)
try
{
messageconnection.close();
}
catch(IOException _ex)
{
a.a("[SMS] Close SMS connection error caught!");
}
return;
Exception exception;
exception;
if(messageconnection != null)
try
{
messageconnection.close();
}
catch(IOException _ex)
{
a.a("[SMS] Close SMS connection error caught!");
}
throw exception;
}
public final void a(Graphics g1, j j1, int k, int l, int i1, boolean flag)
{
j1.d(g1, 0, 0, l, i1);
Font font;
int k1 = (font = j.bV).getHeight() + 2;
switch(a)
{
case 1: // '\001'
g1.setClip(0, 0, l, i1);
int l1 = h;
for(int j2 = 0; j2 < e.length; j2++)
{
if(l1 + k1 <= 0)
{
if(j2 == e.length - 1)
break;
l1 += k1;
continue;
}
if(l1 + k1 * 2 > i1)
{
l1 += k1;
} else
{
int j3 = font.stringWidth(e[j2]);
j1.a(g1, e[j2], l - j3 >> 1, l1, 5);
l1 += k1;
}
}
if(h + e.length * k1 <= 0)
h = (short)(i - (k1 << 1));
if(k != 3 && k != 7)
{
int k2 = font.stringWidth(f);
int k3 = flag ? 2 : l - k2 - 2;
if(f != null && f.length() > 0)
j1.a(g1, f, k3, i1 - k1 - 2, 5);
}
int l2 = font.stringWidth(g);
int l3 = flag ? l - l2 - 2 : 2;
if(g != null && g.length() > 0)
j1.a(g1, g, l3, i1 - k1 - 2, 5);
return;
case 2: // '\002'
g1.setClip(0, 0, l, i1);
int i2 = i1 - (k1 << 1) >> 1;
int i3 = font.stringWidth("正在发送短消息");
g1.drawString("正在发送短消息", l - i3 >> 1, i2, 20);
i2 += k1;
i3 = font.stringWidth("请稍候...");
j1.a(g1, "请稍候...", l - i3 >> 1, i2, 5);
return;
case 3: // '\003'
case 4: // '\004'
g1.setClip(0, 0, l, i1);
String s = a != 3 ? "短信发送失败" : "祝贺您,功能已经开启,祝您玩的愉快!";
String as[];
int i4 = (as = j1.a(s, '^', l - 40, font)).length * k1;
int j4 = i1 - i4 >> 1;
for(int k4 = 0; k4 < as.length; k4++)
{
int i5 = l - font.stringWidth(as[k4]) >> 1;
j1.a(g1, as[k4], i5, j4, 5);
j4 += k1;
}
int l4 = font.stringWidth(f);
int j5 = flag ? 2 : l - l4 - 2;
if(f != null && f.length() > 0)
j1.a(g1, f, j5, i1 - k1 - 2, 5);
break;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?