www.pudn.com > jrar-0.40-source-icons.zip > Jrar.java


/* 
 * Copyright (C) 2003-2004 Andrew Smith 
 *  
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation; either version 2 of the License, or (at your option) any later 
 * version. 
 *  
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 
 * details. 
 *  
 * You should have received a copy of the GNU General Public License along with 
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
 * Place, Suite 330, Boston, MA 02111-1307 USA 
 */ 
 
public class Jrar { 
 
    private static boolean DISPLAYHELP = false; 
 
    private static boolean DEBUG = true; 
 
    private static DebugWindow dw; 
 
    private static JrarGUI jgui; 
 
    public static void main(String[] args) { 
        if (args.length > 0) { 
            for (int i = 0; i < args.length; i++) { 
            if ((args[i].equals("--help")) || (args[i].equals("-h") || args[i].equals("/?"))) 
                DISPLAYHELP = true; 
             
            else if (args[i].equals("--debug")) DEBUG = true; 
            } 
        } 
        new Jrar(); 
    } 
 
    public Jrar() { 
        if (!DISPLAYHELP) { 
            if (DEBUG) dw = new DebugWindow(this); 
            jgui = new JrarGUI(this); 
        } 
        else { 
            new DisplayCMDHelpScreen(); 
        } 
    } 
 
    public void stopDebugging() { 
        dw.dispose(); 
        jgui.debuggingStopped(); 
        DEBUG = false; 
    } 
 
    public void addToDebugWindow(String s) { 
        if (DEBUG) dw.addDebugOutput(s); 
    } 
     
    public boolean isDebugOn() { 
        return DEBUG; 
    } 
 
    public void switchDWVisibilaty() { 
        dw.debugFrameVisiability(); 
    } 
 
    public void createNewAddingProcess(String currentFile, String switchesToUse, String filesToAdd) { 
        AddingRarProcess arp = new AddingRarProcess(currentFile, switchesToUse, filesToAdd, this); 
        arp.start(); 
    } 
 
    public void updateJGUIStatusBar(String s) { 
        jgui.updateStatusBar(s); 
    } 
 
    public void setJGUIButtonsState(boolean b) { 
        jgui.setButtonsState(b); 
    } 
 
    public void extractionRarProcessFinishedSucessfully() { 
        jgui.extractionRarProcessFinishedSucessfully(); 
    } 
 
    public char getOverwriteInput(String tempFileName) { 
        //	TODO 
        return 'c'; 
    } 
 
    public void newExtractionRarProcess(String rarFile, String filesToExtract, 
            String dir) { 
 
        ExtractionRarProcess erp = new ExtractionRarProcess(rarFile, 
                filesToExtract, dir, this); 
        erp.start(); 
    } 
     
    public void addCancelButtonToJGUIStatusBar(RarProcess rp) { 
        //	TODO addCancelButtonToJGUIStatusBar 
        jgui.addCancelButtonToStatusBar(rp); 
    } 
 
    public void addingRarProcessFinishedSucessfully() { 
        // TODO Auto-generated method stub 
        jgui.addingRarProcessFinishedSucessfully(); 
         
    } 
 
    public void extractionRarProcessStopped() { 
        // TODO Auto-generated method stub 
         
    } 
 
    public void addingRarProcessStopped() { 
        // TODO Auto-generated method stub 
         
    } 
 
    public String noCurrentRarFileOpen() { 
        return jgui.newRarFilePopup(); 
    } 
}