format code

This commit is contained in:
2014-11-16 15:30:27 +01:00
parent 4246b92e85
commit 6d3974db53
30 changed files with 1484 additions and 1490 deletions
+47 -51
View File
@@ -1,51 +1,47 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.process;
import com.jpexs.helpers.ProgressListener;
import com.jpexs.helpers.Searchable;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.Map;
/**
*
* @author JPEXS
*/
public interface Process extends Comparable<Process>, Searchable {
public String getFilePath();
public String getFileName();
public BufferedImage getIcon();
@Override
public String toString();
public String getPid();
@Override
public Map<Long, InputStream> search(byte[]
... data);
@Override
public Map<Long, InputStream> search(ProgressListener progListener, byte[]
... data);
}
/*
* Copyright (C) 2010-2014 JPEXS
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.process;
import com.jpexs.helpers.ProgressListener;
import com.jpexs.helpers.Searchable;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.Map;
/**
*
* @author JPEXS
*/
public interface Process extends Comparable<Process>, Searchable {
public String getFilePath();
public String getFileName();
public BufferedImage getIcon();
@Override
public String toString();
public String getPid();
@Override
public Map<Long, InputStream> search(byte[]... data);
@Override
public Map<Long, InputStream> search(ProgressListener progListener, byte[]... data);
}
+92 -94
View File
@@ -1,94 +1,92 @@
/*
* Copyright (C) 2010-2014 JPEXS
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.process.win32;
import com.jpexs.helpers.ProgressListener;
import com.jpexs.process.Process;
import com.sun.jna.platform.win32.WinDef.DWORD;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import java.util.Map;
/**
*
* @author JPEXS
*/
public class Win32Process implements Process {
public String filePath;
public String fileName;
public BufferedImage icon;
public DWORD th32ProcessID;
@Override
public String getPid() {
return "" + th32ProcessID.longValue();
}
public Win32Process(String filePath, String fileName, BufferedImage icon, DWORD th32ProcessID) {
this.filePath = filePath;
this.fileName = fileName;
this.icon = icon;
this.th32ProcessID = th32ProcessID;
}
@Override
public String toString() {
return new File(filePath).getName() + " (pid " + th32ProcessID.longValue() + ")";
}
@Override
public int compareTo(Process o) {
if (!(o instanceof Win32Process)) {
return -1;
}
Win32Process p = (Win32Process) o;
int ret = fileName.toLowerCase().compareTo(p.fileName.toLowerCase());
if (ret == 0) {
ret = th32ProcessID.intValue() - p.th32ProcessID.intValue();
}
return ret;
}
@Override
public String getFilePath() {
return filePath;
}
@Override
public String getFileName() {
return fileName;
}
@Override
public BufferedImage getIcon() {
return icon;
}
@Override
public Map<Long, InputStream> search(byte[]
... data) {
return search(null, data);
}
@Override
public Map<Long, InputStream> search(ProgressListener progListener, byte[]
... data) {
return Win32ProcessTools.findBytesInProcessMemory(progListener, th32ProcessID, data);
}
}
/*
* Copyright (C) 2010-2014 JPEXS
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.process.win32;
import com.jpexs.helpers.ProgressListener;
import com.jpexs.process.Process;
import com.sun.jna.platform.win32.WinDef.DWORD;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import java.util.Map;
/**
*
* @author JPEXS
*/
public class Win32Process implements Process {
public String filePath;
public String fileName;
public BufferedImage icon;
public DWORD th32ProcessID;
@Override
public String getPid() {
return Long.toString(th32ProcessID.longValue());
}
public Win32Process(String filePath, String fileName, BufferedImage icon, DWORD th32ProcessID) {
this.filePath = filePath;
this.fileName = fileName;
this.icon = icon;
this.th32ProcessID = th32ProcessID;
}
@Override
public String toString() {
return new File(filePath).getName() + " (pid " + th32ProcessID.longValue() + ")";
}
@Override
public int compareTo(Process o) {
if (!(o instanceof Win32Process)) {
return -1;
}
Win32Process p = (Win32Process) o;
int ret = fileName.toLowerCase().compareTo(p.fileName.toLowerCase());
if (ret == 0) {
ret = th32ProcessID.intValue() - p.th32ProcessID.intValue();
}
return ret;
}
@Override
public String getFilePath() {
return filePath;
}
@Override
public String getFileName() {
return fileName;
}
@Override
public BufferedImage getIcon() {
return icon;
}
@Override
public Map<Long, InputStream> search(byte[]... data) {
return search(null, data);
}
@Override
public Map<Long, InputStream> search(ProgressListener progListener, byte[]... data) {
return Win32ProcessTools.findBytesInProcessMemory(progListener, th32ProcessID, data);
}
}
@@ -148,7 +148,7 @@ public class Win32ProcessTools extends ProcessTools {
Map<String, Character> ret = new HashMap<>();
for (char d = 'A'; d <= 'Z'; d++) {
char[] buf = new char[1024];
int len = Kernel32.INSTANCE.QueryDosDevice("" + d + ":", buf, buf.length).intValue();
int len = Kernel32.INSTANCE.QueryDosDevice(d + ":", buf, buf.length).intValue();
String tar = new String(buf, 0, len);
tar = tar.trim();
if (!"".equals(tar)) {