Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Amir
Language: C/C++
Code:
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 2012/11/26 09:20:39 ب.ظ
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   SuperMainProjectFrame.java

import ODDialogs.*;
import ODFileUtil.ODFileUtil;
import ODRandom.ODRandom;
import java.awt.FileDialog;
import java.io.File;

class OLUpdateLicenceBox extends UpdateLicenceBox
{

    OLUpdateLicenceBox(MainProjectFrame theowner, int thecontext)
    {
        super(theowner, true);
        owner = theowner;
        fparent = theowner;
        context = thecontext;
    }

    public void InstallLicence(String fullpath)
    {
        String dir = System.getProperty("user.dir");
        OlineLauncher ptr = new OlineLauncher(owner, fullpath, owner.superowner.licencepath);
        int retval = ptr.constructret;
        if(retval != 2)
        {
            ptr.UpdateFields();
            (new MessageDialog(fparent, true, "Update Licence", "Licence update success", "Message")).show();
            String boxstr = getBoxText();
            int index = boxstr.indexOf(">>IPPort=");
            if(index != -1)
            {
                String substr = boxstr.substring(index + ">>IPPort=".length());
                int index2 = substr.indexOf("\n");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                index2 = substr.indexOf("\r");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                index2 = substr.indexOf(":");
                if(index2 != -1)
                {
                    String newip = substr.substring(0, index2);
                    String newport = substr.substring(index2 + 1);
                    if(newip.length() > 0 && newport.length() > 0)
                        try
                        {
                            int thenewport = (new Integer(newport)).intValue();
                            owner.superowner.remoteIP = new String(newip);
                            owner.superowner.remotePort = thenewport;
                        }
                        catch(NumberFormatException e)
                        {
                            e.printStackTrace();
                        }
                }
            }
            index = boxstr.indexOf(">>Password=");
            if(index != -1)
            {
                String substr = boxstr.substring(index + ">>Password=".length());
                int index2 = substr.indexOf("\n");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                index2 = substr.indexOf("\r");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                if(substr.length() > 0)
                    owner.superowner.remotepass = new String(substr);
            }
            index = boxstr.indexOf(">>Login=");
            if(index != -1)
            {
                String substr = boxstr.substring(index + ">>Login=".length());
                int index2 = substr.indexOf("\n");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                index2 = substr.indexOf("\r");
                if(index2 != -1)
                    substr = substr.substring(0, index2);
                if(substr.length() > 0)
                    owner.superowner.remoteuser = new String(substr);
            }
            if(context == 0)
                new jAboutIn(owner, false, owner);
            MyCloseDialog();
        } else
        {
            (new ErrorDialog(fparent, true, "Update Licence Failed", "Update Licence Failed")).show();
        }
    }

    public void LoadFromFile()
    {
        FileDialog file = new FileDialog(fparent, "Localize the new licence", 0);
        file.setFile("*.key");
        file.show();
        String curFile;
        if((curFile = file.getFile()) != null)
        {
            String fullpath = file.getDirectory() + curFile;
            InstallLicence(fullpath);
        }
    }

    public void Install(String s)
    {
        int theindex = s.indexOf(">>Licence");
        if(theindex == -1)
        {
            (new jErrorDialog(fparent, true, "Update Licence Failed", "Update Licence Failed (1)")).show();
            return;
        }
        theindex = s.indexOf('\n', theindex);
        if(theindex == -1)
        {
            theindex = s.indexOf('\r', theindex);
            if(theindex == -1)
            {
                (new jErrorDialog(fparent, true, "Update Licence Failed", "Update Licence Failed (2)")).show();
                return;
            }
        }
        String res = s.substring(theindex + 1);
        res = res.replace('\r', ' ');
        res = res.replace('\n', ' ');
        res = res.replaceAll(" ", "");
        if(res.length() < 1024)
        {
            (new jErrorDialog(fparent, true, "Update Licence Failed", "Update Licence Failed (3)")).show();
            return;
        }
        if(res.length() > 1024)
            res = res.substring(0, 1024);
        res = res.replace('a', 'A');
        res = res.replace('b', 'B');
        res = res.replace('c', 'C');
        res = res.replace('d', 'D');
        res = res.replace('e', 'E');
        res = res.replace('f', 'F');
        ODRandom odr = new ODRandom(false);
        ODFileUtil.CreateBinaryFileFromString(owner.superowner.userhome + owner.superowner.TMPDIR + File.separatorChar + "tmpkey.tmp", odr.DeHex(res));
        InstallLicence(owner.superowner.userhome + owner.superowner.TMPDIR + File.separatorChar + "tmpkey.tmp");
    }

    MainProjectFrame owner;
    MainProjectFrame fparent;
    int context;
}
Comments: