⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flashsms.java

📁 flash sms 闪信源码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) ansi 
// Source File Name:   FlashSMS.java

import com.siemens.mp.io.File;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class FlashSMS extends MIDlet
    implements CommandListener
{

    public FlashSMS()
    {
        smsRaw = "";
        abyte0 = new byte[181];
        iblink = 0;
        bSC = false;
        sLan = System.getProperty("com.siemens.language");
        if(sLan.compareTo("zh") == 0)
            bSC = true;
        if(bSC)
        {
            text1 = new TextBox("闪信息", "", 160, 0);
            cmExit = new Command("退出", 7, 4);
            cmInfo = new Command("说明", 1, 3);
            cmSave = new Command("存为闪信息", 1, 1);
            cmOK = new Command("确认", 4, 0);
            cmCancel = new Command("取消", 3, 1);
            cmBlink = new Command("NOKIA闪标记", 1, 5);
            alert = new Alert("闪信息");
            title = "输入文件名:";
        } else
        {
            text1 = new TextBox("FlashSMS", "", 160, 0);
            cmExit = new Command("Exit", 7, 4);
            cmInfo = new Command("Info", 1, 3);
            cmSave = new Command("SaveAsFlash", 1, 1);
            cmOK = new Command("OK", 4, 0);
            cmCancel = new Command("Cancel", 3, 1);
            cmBlink = new Command("NOKIABlinkTag", 1, 5);
            alert = new Alert("FlashSMS");
            title = "Input Name:";
        }
        fn = new File();
        display = Display.getDisplay(this);
    }

    protected void startApp()
    {
        text1.addCommand(cmExit);
        text1.addCommand(cmInfo);
        text1.addCommand(cmSave);
        text1.addCommand(cmBlink);
        text1.setCommandListener(this);
        display.setCurrent(text1);
    }

    public void commandAction(Command command, Displayable displayable)
    {
        String s = "";
        if(command == cmExit)
            destroyApp(true);
        else
        if(command == cmBlink)
        {
            text1.insert(blink, 0, 1, text1.getCaretPosition());
            iblink++;
        } else
        if(command == cmInfo)
        {
            if(bSC)
                s = "闪信息 2.0\n\n1.编辑短消息\n2.选项中选择'存为闪信息'\n3.退出并进入多媒体卡管理器,进入\\Java\\jam\\...\\FlashSMS\\Storage\n4.选项中查看FlashSMS\n5.选项中发送\n\nRoaming 制作";
            else
                s = "FlashSMS 2.0\n\n1.Compose SMS\n2.Select 'SaveAsFlash' from Option\n3.Exit and enter \\Java\\jam\\...\\FlashSMS\\Storage folder by using Card-Explorer\n4.View flashSMS\n5.Send it from Option\n\nby Roaming\n\nChina";
        } else
        if(command == cmSave)
        {
            if(iblink % 2 == 1)
                text1.insert(blink, 0, 1, text1.getString().length());
            smsRaw = text1.getString();
            getName();
            iblink = 0;
        } else
        if(command == cmOK)
        {
            String s1 = text1.getString() + ".smo";
            text1.setTitle("FlashSMS");
            text1.setString(smsRaw);
            text1.removeCommand(cmOK);
            text1.removeCommand(cmCancel);
            text1.addCommand(cmSave);
            text1.addCommand(cmExit);
            text1.addCommand(cmInfo);
            text1.addCommand(cmBlink);
            for(int i = 0; i < abyte0.length; i++)
                abyte0[i] = -1;

            byte abyte1[] = getBytes(smsRaw);
            if(bUnicode)
            {
                System.arraycopy(FLASH_HEAD_CN, 0, abyte0, 0, 20);
                int j = smsRaw.length() * 2;
                System.arraycopy(abyte1, 0, abyte0, 21, j);
                abyte0[20] = (byte)j;
            } else
            {
                System.arraycopy(FLASH_HEAD, 0, abyte0, 0, 20);
                int k = smsRaw.length();
                byte abyte2[] = make7BitString(smsRaw.getBytes(), k);
                System.arraycopy(abyte2, 0, abyte0, 21, abyte2.length);
                abyte0[20] = (byte)k;
            }
            try
            {
                int l = fn.open(s1);
                fn.write(l, abyte0, 0, abyte0.length);
                if(bSC)
                    s = "已存为\n" + s1;
                else
                    s = "Saved as file " + s1;
                text1.setString("");
                fn.close(l);
            }
            catch(Exception exception)
            {
                if(bSC)
                    s = "文件写入错";
                else
                    s = "File write error";
            }
        } else
        {
            text1.setTitle("FlashSMS");
            text1.setString(smsRaw);
            text1.removeCommand(cmOK);
            text1.removeCommand(cmCancel);
            text1.addCommand(cmSave);
            text1.addCommand(cmExit);
            text1.addCommand(cmInfo);
            text1.addCommand(cmBlink);
        }
        if(s != "")
        {
            alert.setString(s);
            display.setCurrent(alert);
        }
    }

    public static byte[] make7BitString(byte abyte1[], int i)
    {
        if(i == 0)
            return null;
        byte abyte2[] = new byte[((i + 1) * 7) / 8];
        for(int j = 0; j < abyte2.length; j++)
            abyte2[j] = -1;

        int k = 0;
        int l = 0;
        int i1 = 0;
        int j1 = 0;
        do
        {
            if(i1 >= i)
            {
                if(l != 0)
                    abyte2[j1++] = (byte)(k & 0xff);
                return abyte2;
            }
            int k1 = abyte1[i1++];
            if(k1 < 0)
                k1 = 256 + k1;
            if(l == 0)
            {
                k = 0;
                k |= k1;
                l = 7;
            } else
            {
                k |= k1 << l;
                abyte2[j1++] = (byte)(k & 0xff);
                k >>= 8;
                l--;
            }
        } while(true);
    }

    private byte[] getBytes(String s)
    {
        char ac[] = s.toCharArray();
        byte abyte1[] = new byte[ac.length * 2];
        bUnicode = false;
        for(int i = 0; i < ac.length; i++)
        {
            char c = ac[i];
            abyte1[i * 2] = (byte)((c & 0xff00) >>> 8);
            if(abyte1[i * 2] != 0)
                bUnicode = true;
            abyte1[i * 2 + 1] = (byte)(c & 0xff);
        }

        return abyte1;
    }

    protected void pauseApp()
    {
    }

    protected void destroyApp(boolean flag)
    {
        notifyDestroyed();
    }

    public void getName()
    {
        text1.setTitle(title);
        text1.setString("flashSMS");
        text1.removeCommand(cmExit);
        text1.removeCommand(cmInfo);
        text1.removeCommand(cmSave);
        text1.removeCommand(cmBlink);
        text1.addCommand(cmOK);
        text1.addCommand(cmCancel);
    }

    private boolean bSC;
    private boolean bUnicode;
    private String sLan;
    private Display display;
    private TextBox text1;
    private Command cmExit;
    private Command cmInfo;
    private Command cmSave;
    private Command cmOK;
    private Command cmCancel;
    private Command cmBlink;
    private Alert alert;
    String smsRaw;
    byte abyte0[];
    String title;
    char blink[] = {
        '\001', '\001'
    };
    int iblink;
    private static final byte FLASH_HEAD[] = {
        11, 11, 0, 0, 0, 7, 6, 0, 0, 0, 
        7, 0, 0, 17, 0, 0, -127, 0, -16, 0
    };
    private static final byte FLASH_HEAD_CN[] = {
        11, 11, 0, 0, 0, 7, 6, 0, 0, 0, 
        0, 0, 0, 17, 0, 0, -127, 0, 24, 0
    };
    private File fn;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -