📄 appconfig.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: AppConfig.java
package carven;
import java.io.FileInputStream;
import java.util.Properties;
// Referenced classes of package carven:
// Common
public class AppConfig
{
private String configFilePath;
private Properties property;
public AppConfig(String configFilePath)
throws Exception
{
Properties property = new Properties();
FileInputStream inStream = new FileInputStream(configFilePath);
property.load(inStream);
inStream.close();
this.property = property;
this.configFilePath = configFilePath;
}
public String GetParam(String key)
throws Exception
{
String tmp = property.getProperty(key);
if (tmp == null)
return null;
else
return new String(tmp.getBytes("iso8859-1"));
}
public void SetParam(String key, String value)
throws Exception
{
String myFile = Common.ReadFile(configFilePath);
int pos1 = myFile.indexOf(key + "=");
int pos2 = myFile.indexOf('\n', pos1);
int posTmp = myFile.indexOf('\r', pos1);
if (pos2 > posTmp && posTmp != -1)
pos2 = posTmp;
int pos3 = myFile.length() - 1;
if (pos2 == -1)
pos2 = myFile.length();
String str1 = myFile.substring(0, pos1);
String str2 = myFile.substring(pos2 - 1, pos3);
String result = str1 + key + "=" + value + str2;
Common.WriteFile(result, configFilePath);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -