// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: packimports(3) // Source File Name: dlkTFTPProcess.java import java.applet.Applet; import java.awt.*; import java.io.*; import java.net.*; public class dlkTFTPProcess extends Applet implements Runnable { public dlkTFTPProcess() { } public void init() { try { setLayout(null); setBackground(Color.lightGray); mURL = new URL(getDocumentBase(), getParameter("DataPath")); int i = 0; m_nTimeout = 1000; m_bStop = true; int j = Integer.parseInt(getParameter("Interval")); int k = Integer.parseInt(getParameter("Label2Int")); m_bStop = false; if(j == 255) { m_bStop = true; j = 1; } m_nTimeout = j * 1000; m_Table = new BorderTable[3]; m_Table[0] = new BorderTable(1, 2, 8, 4, false); m_Table[1] = new BorderTable(1, 2, 8, 4, true); m_Table[2] = new BorderTable(1, 2, 8, 4, true); m_Table[0].SetColumnInfo(0, 0, 1); m_Table[0].SetColumnInfo(1, 300, 0); String s = getParameter("FontName"); m_Table[0].SetFontInfo(s); m_Table[1].SetFontInfo(s); m_Table[2].SetFontInfo(s); s = getParameter("iBgClr_ObjectName"); int l = s != null ? Integer.parseInt(s) : -1; s = getParameter("iBgClr_Description"); int i1 = s != null ? Integer.parseInt(s) : -1; s = getParameter("iFontClr_ObjectName"); int j1 = s != null ? Integer.parseInt(s) : -1; s = getParameter("iFontClr_Description"); int k1 = s != null ? Integer.parseInt(s) : -1; m_Table[1].SetColorInfo(l, j1, i1, k1); m_Table[2].SetColorInfo(l, j1, i1, k1); String as[] = { "Current Status:" }; for(int l1 = 0; l1 < 1; l1++) m_Table[0].SetItem(l1, 0, as[l1]); m_Table[0].SetItem(0, 1, "Unknown"); m_Table[1].SetColumnInfo(0, 0, 1); m_Table[1].SetColumnInfo(1, 120, 0); String as1[] = { "Percentage" }; for(int i2 = 0; i2 < 1; i2++) { m_Table[1].SetItem(i2, 0, as1[i2]); m_Table[1].SetItem(i2, 1, "0%"); } m_Table[2].SetColumnInfo(0, 0, 1); m_Table[2].SetColumnInfo(1, 120, 0); String as2[] = { "Write Flash Status" }; for(int j2 = 0; j2 < 1; j2++) { m_Table[2].SetItem(j2, 0, as2[j2]); m_Table[2].SetItem(j2, 1, "0%"); } s = getParameter("FontName"); m_Label1 = new Label("File Transfer:"); m_Label1.setFont(new Font(s == null ? "Arial" : s, 1, 12)); m_Label2 = new Label(getParameter("Label2String")); m_Label2.setFont(new Font(s == null ? "Arial" : s, 1, 12)); int k2 = m_Table[0].GetTableWidth() + 2; int l2 = m_Table[0].GetTableHeight() + 2; m_Table[0].move(0, i); m_Table[0].resize(k2, l2); l2 += 10 + i; m_Label1.move(8, l2); m_Label1.resize(150, 20); l2 += 30; m_Table[1].move(0, l2); m_Table[1].resize(m_Table[1].GetTableWidth() + 2, m_Table[1].GetTableHeight() + 2); l2 += m_Table[1].GetTableHeight() + 6; if(k2 < m_Table[1].GetTableWidth() + 2) k2 = m_Table[1].GetTableWidth() + 2; l2 += 10 + i; m_Label2.move(8, l2); m_Label2.resize(150, 20); l2 += 30; m_Table[2].move(0, l2); m_Table[2].resize(m_Table[2].GetTableWidth() + 2, m_Table[2].GetTableHeight() + 2); l2 += m_Table[2].GetTableHeight() + 6; if(k2 < m_Table[2].GetTableWidth() + 2) k2 = m_Table[2].GetTableWidth() + 2; resize(k2, l2); add(m_Table[0]); add(m_Label1); add(m_Table[1]); if(k == 1) { add(m_Label2); add(m_Table[2]); } } catch(MalformedURLException malformedurlexception) { System.out.println("MalformedURLException " + malformedurlexception.getMessage()); } } public void repaint() { for(int i = 0; i < 3; i++) m_Table[i].repaint(); } public void start() { if(thread == null) { thread = new Thread(this); thread.start(); } } public void stop() { if(thread != null) { thread.stop(); thread = null; } } public void run() { int i = 0; int j = 2; boolean flag = false; do { do { try { if(!flag || j != 0) { URLConnection urlconnection = mURL.openConnection(); urlconnection.setDefaultUseCaches(false); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(urlconnection.getInputStream())); for(int k = 0; k < 1; k++) { i = Integer.parseInt(bufferedreader.readLine()); if(i == 0) { m_Table[0].SetItem(k, 1, "No TFTP Process."); j = 0; flag = true; } else if(i == 1) m_Table[0].SetItem(k, 1, "Connecting . . ."); else if(i == 2) { m_Table[0].SetItem(k, 1, "Connect to Server Error !!"); j = 0; flag = true; } else if(i == 3) { m_Table[0].SetItem(k, 1, "File not found !!"); j = 0; flag = true; } else if(i == 4) m_Table[0].SetItem(k, 1, "File transferring..."); else if(i == 5) { m_Table[0].SetItem(k, 1, "Connection Terminated !!"); j = 0; flag = true; } else if(i == 6) { m_Table[0].SetItem(k, 1, "File Transfer Success !!"); flag = false; } else { m_Table[0].SetItem(k, 1, "No TFTP Process."); j = 0; flag = true; } } for(int l = 0; l < 1; l++) { String s = bufferedreader.readLine(); m_Table[1].SetItem(l, 1, s + "%"); } for(int i1 = 0; i1 < 1; i1++) { String s1 = bufferedreader.readLine(); int j1; if(s1 == null) j1 = 2; else j1 = Integer.parseInt(s1); if(j1 == 100) m_Table[2].SetItem(i1, 1, "Completed."); else if(j1 == 1 || j1 == 2) { flag = false; m_Table[2].SetItem(i1, 1, "Writing . . ."); } else if(j1 == 10) m_Table[2].SetItem(i1, 1, "Firmware Fail !"); else m_Table[2].SetItem(i1, 1, "-"); if(i == 6 && j1 == 100 || j1 == 10) { j--; flag = true; } } bufferedreader.close(); } } catch(IOException ioexception) { System.out.println("IOException " + ioexception.getMessage()); } repaint(); try { Thread.sleep(m_nTimeout); } catch(InterruptedException interruptedexception) { } } while(!m_bStop); thread.suspend(); } while(true); } Thread thread; private URL mURL; boolean m_bStop; int m_nTimeout; BorderTable m_Table[]; Label m_Label1; Label m_Label2; }