settings.java

来自「java ftp 操作代码,程序可以直接运行」· Java 代码 · 共 678 行 · 第 1/2 页

JAVA
678
字号
/* * 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. */package net.sf.jftp.config;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.util.Properties;public class Settings{    private static Properties p = new Properties();    public static final String propertyFilename = System.getProperty("user.home") +                                                  File.separator +                                                  ".jftp/jftp.properties".replace('/',                                                                                  File.separatorChar);    public static boolean IS_JAVA_1_6 = false;        public static String sshHostKeyVerificationFile = System.getProperty("user.home") +                                                      File.separator + ".jftp" +                                                      File.separator +                                                      ".ssh_hostfile";    public static final String defaultWidth = "840";    public static final String defaultHeight = "640";    public static final String defaultX = "20";    public static final String defaultY = "20";    public static int maxConnections = 3;    public static boolean enableResuming = false; // overridden by JFtp    public static boolean enableUploadResuming = false;    public static boolean noUploadResumingQuestion = true;    public static boolean askToResume = true;    public static boolean reconnect = true;    public static int uiRefresh = 500;    public static int logFlushInterval = 2000; // obsolete    public static boolean useLogFlusher = false; // obsolete    public static int ftpTransferThreadPause = 2000;    public static int smallSize = 0; //100000;    public static int smallSizeUp = 0; //50000;    public static boolean autoUpdate = false;    public static boolean shortProgress = true;    private static String defaultFtpPasvMode = "true";    private static String defaultEnableDebug = "false";    private static String enableMultiThreading = "true";    private static String enableSmbMultiThreading = "true";    private static String enableSftpMultiThreading = "true";    private static String noUploadMultiThreading = "false";    private static String storePasswords = "false";        public static boolean newTableGui = getUseJTableLayout();    public static boolean useFixedTableWidths = true;    public static boolean enableWebDav = false;        // 1: manual, 2: onclick, 0: off    public static int runtimeCommands = 2;    public static boolean askToRun = true;    // currently changed by remotedir on-the-fly    public static boolean showDateNoSize = false;    public static boolean showLocalDateNoSize = false;    // hides some messages like MODE, Type etc.    public static boolean hideStatus = false;    public static boolean showNewlineOption = false;    // for DataConnection - lower means less buffer, more updates in the downloadmanager    // i recommend to use values greater than 2048 bytes    public static int bufferSize = 8192;    // sends NOOPs to ensure that buffers are empty    public static boolean safeMode = false;    // enables some delays     public static boolean enableFtpDelays = false;    // title of the app    public static final String title = "JFtp - The Java Network Browser";    // overridden title for insomniac client    public static final String insomniacTitle = ">>> Insomniac client BETA 1 <<< Based on JFtp ";    // override ui with the insomniac client configuration    public static boolean isInsomniacClient = false;    public static int refreshDelay = 250;    public static boolean useDefaultDir = true;    // may the windows be resized?    public static boolean resize = true;    public static boolean showFileSize = true;    public static boolean sortDir = true;    public static final int visibleFileRows = 15;    public static int scrollSpeed = 9;    public static int numFiles = 9;    public static final int connectionTimeout = 30000;    public static final int testTimeout = 5000;    public static int statusMessageAfterMillis = 1000;    public static final String defaultDir = "<default>";    public static final String defaultWorkDir = System.getProperty("user.home");    public static final String userHomeDir = System.getProperty("user.home");    public static final String appHomeDir = userHomeDir +                                            "/.jftp/".replace('/',                                                              File.separatorChar);    public static final String greeting = "Have a lot of fun...";    public static final String bookmarks = appHomeDir +                                           "bookmarks.txt".replace('/',                                                                   File.separatorChar);    public static final String ls_out = appHomeDir+".ls_out".replace('/', File.separatorChar);                                     public static final String login_def = appHomeDir +                                           ".login_default".replace('/',                                                                    File.separatorChar);    public static final String login = appHomeDir +                                       ".login".replace('/', File.separatorChar);    //*** The new files that I have created    public static final String last_cons = appHomeDir +                                           ".last_cons".replace('/',                                                                File.separatorChar);    public static final String login_def_sftp = appHomeDir +                                                ".last_cons_sftp".replace('/',                                                                          File.separatorChar);    public static final String login_def_smb = appHomeDir +                                               ".last_cons_smb".replace('/',                                                                        File.separatorChar);    public static final String login_def_nfs = appHomeDir +                                               ".last_cons_nfs".replace('/',                                                                        File.separatorChar);    //***    //*** added in version 1.44    public static final String adv_settings = appHomeDir +                                              ".adv_settings".replace('/',                                                                      File.separatorChar);    //***    public static final String readme = "docs/readme";    public static final String changelog = "docs/CHANGELOG";    public static final String todo = "docs/TODO";    public static final String nfsinfo = "docs/doc/nfsinfo";            public static String iconImage;    public static String hostImage;       public static String closeImage;    public static String infoImage;      public static String listImage;       public static String rmdirImage;      public static String mkdirImage;       public static String refreshImage;    public static String refreshImage2;     public static String cdImage;     public static String cmdImage;       public static String downloadImage;    public static String uploadImage;    public static String fileImage;    public static String dirImage;     public static String codeFileImage;    public static String textFileImage;    public static String execFileImage;    public static String audioFileImage;    public static String videoFileImage;    public static String htmlFileImage;    public static String zipFileImage;    public static String imageFileImage;    public static String presentationFileImage;    public static String spreadsheetFileImage;    public static String bookFileImage;      public static String copyImage;       public static String openImage;    public static String sftpImage;    public static String nfsImage;    public static String webdavImage;      public static String linkImage;    public static String typeImage;    public static String deleteImage;     public static String deleteImage2;     public static String clearImage;     public static String clearImage2;     public static String resumeImage;    public static String resumeImage2;    public static String pauseImage;    public static String pauseImage2;    public static String saveImage;    public static String cdUpImage;    public static String nextRSSImage;    public static String helpImage;        public static String background = "images/back.jpg";        public static boolean isStandalone = true;    public static String hiddenPassword = "<%hidden%>";    public static Object setProperty(String key, String value)    {        return p.setProperty(key, value);    }    public static String getProperty(String key) {    	return ""+p.getProperty(key);    }        public static Object setProperty(String key, int value)    {        return p.setProperty(key, Integer.toString(value));    }    public static Object setProperty(String key, boolean value)    {        String val = "false";        if(value)        {            val = "true";        }        return p.setProperty(key, val);    }    public static void save()    {        try        {            new File(System.getProperty("user.home") + File.separator +                     ".jftp").mkdir();            p.store(new FileOutputStream(propertyFilename), "jftp.properties");        }        catch(Exception e)        {            System.out.println("Cannot save properties...");            //e.printStackTrace();        }    }    public static boolean getHideLocalDotNames() {        String what = p.getProperty("jftp.hideHiddenDotNames", "false");        if(what.trim().equals("false"))        {            return false;        }        else        {            return true;        }    }        public static int getMaxConnections()    {        return maxConnections;    }    public static String getSocksProxyHost()    {        String what = p.getProperty("jftp.socksProxyHost", "");        return what;    }    public static boolean getUseJTableLayout()    {        String what = p.getProperty("jftp.useJTableLayout", "true");        if(what.trim().equals("false"))        {            return false;        }        else        {            return true;        }    }        public static String getSocksProxyPort()    {        String what = p.getProperty("jftp.socksProxyPort", "");        return what;    }    public static boolean getUseBackground()    {        String what = p.getProperty("jftp.useBackground", "true");        if(what.trim().equals("false"))        {            return false;        }        else        {            return true;        }    }    public static boolean getEnableSshKeys()    {        String what = p.getProperty("jftp.useSshKeyVerification", "false");        if(what.trim().equals("false"))        {            return false;        }        else        {            return true;        }    }    public static boolean getEnableResuming()    {        String what = p.getProperty("jftp.enableResuming", "true");        if(what.trim().equals("false"))        {            return false;        }        else        {

⌨️ 快捷键说明

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