📄 commandtxt.java
字号:
package net.aetherial.gis.test.tools;
import java.io.File;
import net.aetherial.gis.surface.CreateFile;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class CommandTxt {
private String head = "";
private String inputPath = "";
private String outputPath = "";
private String fileAddname = "zouxiang";
private String para_input = "E:\\核对工作\\重复路之前\\安徽省";
private String para_output = "E:\\核对工作\\重复路之后\\安徽省";
private final String javaEngin =
"%JAVA_HOME%\\bin\\java -Xmx384m -classpath \".;%CLASSPATH%\"";
private String javaClass =
"net.aetherial.gis.jiaotongbu.output.publicuse.ReCreateQSD";
private boolean showXian = true;
private boolean showShi = true;
public CommandTxt() {
this.initHead();
}
private void initHead() {
head += "E:" + "\r\n";
head += "cd E:\\核对工作\\程序\\软件\\数据生成程序" + "\r\n";
// head += "cd 软件\\数据生成程序" + "\r\n";
head += "@echo on" + "\r\n";
head += "set JAVA_HOME=.\\jre" + "\r\n";
head += "set CLASSPATH=./gps.jar;./jre/lib/comm.jar;./lib/datePicker.jar;./lib/jxl.jar;./lib/batik.jar" +
"\r\n";
}
public void create() {
String n = "";
File[] shis = this.getShiFiles();
File[] xians = null;
for (int i = 0; shis != null && i < shis.length; i++) {
if (isRightFile(shis[i])) {
n = this.head;
n += "\r\n";
xians = shis[i].listFiles();
for (int j = 0; j < xians.length; j++) {
if (isRightFile(xians[j])) {
n += getARecord(shis[i], xians[j]) + "\r\n\r\n";
}
}
this.createFile(new File(getSplash(outputPath) + shis[i].getName() +
"_" + this.fileAddname + ".bat"),
n);
}
}
}
public void createXian() {
String n = "";
File[] shis = this.getShiFiles();
File[] xians = null;
for (int i = 0; shis != null && i < shis.length; i++) {
if (isRightFile(shis[i])) {
xians = shis[i].listFiles();
for (int j = 0; j < xians.length; j++) {
if (isRightFile(xians[j])) {
n = this.head;
n += "\r\n";
n += getARecord(shis[i], xians[j]) + "\r\n\r\n";
this.createFile(new File(getSplash(outputPath) + shis[i].getName() +
"_" + xians[j].getName() +
"_" + this.fileAddname + ".bat"),
n);
}
}
}
}
}
private String getARecord(File shi, File xian) {
String n = "";
n += javaEngin + " " + this.javaClass + " ";
if (this.showShi) {
n += shi.getName() + " ";
}
if (this.showXian) {
n += xian.getName() + " ";
}
n += getSplash(para_input) + shi.getName() + "\\" + xian.getName();
n += " " + getSplash(para_output) + shi.getName() + "\\" + xian.getName();
return n;
}
private boolean isRightFile(File file) {
if (file.getName().indexOf("汇总") != -1 ||
file.getName().indexOf("svn") != -1) {
return false;
}
else {
return true;
}
}
private String getSplash(String path) {
if (path.endsWith("\\")) {
return path;
}
else if (path.endsWith("/")) {
return path;
}
else {
return path + "\\";
}
}
private File[] getShiFiles() {
File anhuisheng = new File(inputPath);
return anhuisheng.listFiles();
}
private void createFile(File file, String content) {
CreateFile cf = new CreateFile(file);
cf.setEncode("GB2312");
cf.memoryToFile(content);
System.out.println(file.getAbsolutePath());
}
public void setInputPath(String inputPath) {
this.inputPath = inputPath;
}
public void setPara_output(String para_output) {
this.para_output = para_output;
}
public void setPara_input(String para_input) {
this.para_input = para_input;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public void setJavaClass(String javaClass) {
this.javaClass = javaClass;
}
public void setFileAddname(String fileAddname) {
this.fileAddname = fileAddname;
}
public void setShowXian(boolean showXian) {
this.showXian = showXian;
}
public void setShowShi(boolean showShi) {
this.showShi = showShi;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -