📄 uidebuggenerator.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: UIDebugGenerator.java
package org.gudy.azureus2.ui.swt.debug;
import com.aelitis.azureus.core.*;
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.logging.*;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.platform.PlatformManager;
import org.gudy.azureus2.platform.PlatformManagerFactory;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.shells.InputShell;
// Referenced classes of package org.gudy.azureus2.ui.swt.debug:
// ObfusticateShell
public class UIDebugGenerator
{
public UIDebugGenerator()
{
}
public static void generate()
{
Display display;
Shell shells[];
File path;
int i;
display = Display.getCurrent();
if (display == null)
return;
while (display.readAndDispatch()) ;
shells = display.getShells();
if (shells == null || shells.length == 0)
return;
path = new File(SystemProperties.getUserPath(), "debug");
if (!path.isDirectory())
path.mkdir();
else
try
{
File files[] = path.listFiles();
for (int i = 0; i < files.length; i++)
files[i].delete();
}
catch (Exception e) { }
i = 0;
_L3:
if (i >= shells.length) goto _L2; else goto _L1
_L1:
Image image;
Rectangle clientArea;
GC gc;
Shell shell = shells[i];
image = null;
if (shell.getData("class") instanceof ObfusticateShell)
{
ObfusticateShell shellClass = (ObfusticateShell)shell.getData("class");
try
{
image = shellClass.generateObfusticatedImage();
}
catch (Exception e)
{
Debug.out((new StringBuilder()).append("Obfusticating shell ").append(shell).toString(), e);
}
break MISSING_BLOCK_LABEL_251;
}
clientArea = shell.getClientArea();
image = new Image(display, clientArea.width, clientArea.height);
gc = new GC(shell);
gc.copyArea(image, clientArea.x, clientArea.y);
gc.dispose();
break MISSING_BLOCK_LABEL_251;
Exception exception;
exception;
gc.dispose();
throw exception;
if (image != null)
{
File file = new File(path, (new StringBuilder()).append("image-").append(i).append(".jpg").toString());
String sFileName = file.getAbsolutePath();
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = (new ImageData[] {
image.getImageData()
});
imageLoader.save(sFileName, 4);
}
continue; /* Loop/switch isn't completed */
Exception e;
e;
Logger.log(new LogEvent(LogIDs.GUI, "Creating Obfusticated Image", e));
i++;
goto _L3
_L2:
InputShell inputShell = new InputShell("UIDebugGenerator.messageask.title", "UIDebugGenerator.messageask.text", true);
String message = inputShell.open();
if (inputShell.isCanceled())
return;
if (message == null || message.length() == 0)
{
Utils.openMessageBox(Utils.findAnyShell(), 32, "UIDebugGenerator.message.cancel", (String[])null);
return;
}
try
{
File fUserMessage = new File(path, "usermessage.txt");
FileWriter fw = new FileWriter(fUserMessage);
fw.write(message);
fw.close();
}
catch (IOException e)
{
e.printStackTrace();
}
AzureusCoreFactory.getSingleton().createOperation(3, new AzureusCoreOperationTask(path) {
final File val$path;
public void run(AzureusCoreOperation operation)
{
try
{
File fEvidence = new File(path, "evidence.log");
FileWriter fw = new FileWriter(fEvidence);
PrintWriter pw = new PrintWriter(fw);
AEDiagnostics.generateEvidence(pw);
fw.close();
}
catch (IOException e)
{
Debug.printStackTrace(e);
}
}
{
path = file;
Object();
}
});
try
{
File outFile = new File(SystemProperties.getUserPath(), "debug.zip");
if (outFile.exists())
outFile.delete();
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFile));
File logPath = new File(SystemProperties.getUserPath(), "logs");
File files[] = logPath.listFiles(new FileFilter() {
public boolean accept(File pathname)
{
return pathname.getName().endsWith(".log");
}
});
addFilesToZip(out, files);
File userPath = new File(SystemProperties.getUserPath());
files = userPath.listFiles(new FileFilter() {
public boolean accept(File pathname)
{
return pathname.getName().endsWith(".log");
}
});
addFilesToZip(out, files);
files = path.listFiles();
addFilesToZip(out, files);
long ago = SystemTime.getCurrentTime() - 0x1cf7c5800L;
File azureusPath = new File(SystemProperties.getApplicationPath());
files = azureusPath.listFiles(new FileFilter(ago) {
final long val$ago;
public boolean accept(File pathname)
{
return pathname.getName().startsWith("hs_err") && pathname.lastModified() > ago;
}
{
ago = l;
Object();
}
});
addFilesToZip(out, files);
File javaLogPath = new File(System.getProperty("user.home"), (new StringBuilder()).append("Library").append(File.separator).append("Logs").append(File.separator).append("Java").toString());
if (javaLogPath.isDirectory())
{
files = javaLogPath.listFiles(new FileFilter(ago) {
final long val$ago;
public boolean accept(File pathname)
{
return pathname.getName().endsWith("log") && pathname.lastModified() > ago;
}
{
ago = l;
Object();
}
});
addFilesToZip(out, files);
}
boolean bLogToFile = COConfigurationManager.getBooleanParameter("Logging Enable");
String sLogDir = COConfigurationManager.getStringParameter("Logging Dir", "");
if (bLogToFile && sLogDir != null)
{
File loggingFile = new File(sLogDir, "az.log");
if (loggingFile.isFile())
addFilesToZip(out, new File[] {
loggingFile
});
}
out.close();
if (outFile.exists())
{
int result = Utils.openMessageBox(Utils.findAnyShell(), 0x10122, "UIDebugGenerator.complete", new String[] {
outFile.toString()
});
if (result == 32)
try
{
PlatformManagerFactory.getPlatformManager().showFile(outFile.getAbsolutePath());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
return;
}
private static void addFilesToZip(ZipOutputStream out, File files[])
{
byte buf[] = new byte[1024];
if (files == null)
return;
for (int j = 0; j < files.length; j++)
{
File file = files[j];
FileInputStream in;
try
{
in = new FileInputStream(file);
}
catch (FileNotFoundException e)
{
continue;
}
try
{
ZipEntry entry = new ZipEntry(file.getName());
entry.setTime(file.lastModified());
out.putNextEntry(entry);
int len;
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
out.closeEntry();
}
catch (IOException e)
{
e.printStackTrace();
}
try
{
in.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
public static void obfusticateArea(Display display, Image image, Rectangle bounds)
{
GC gc = new GC(image);
gc.setBackground(display.getSystemColor(1));
gc.setForeground(display.getSystemColor(3));
gc.fillRectangle(bounds);
gc.drawRectangle(bounds);
int x2 = bounds.x + bounds.width;
int y2 = bounds.y + bounds.height;
gc.drawLine(bounds.x, bounds.y, x2, y2);
gc.drawLine(x2, bounds.y, bounds.x, y2);
gc.dispose();
break MISSING_BLOCK_LABEL_107;
Exception exception;
exception;
gc.dispose();
throw exception;
}
public static void obfusticateArea(Display display, Image image, Rectangle bounds, String text)
{
GC gc;
if (bounds.isEmpty())
return;
if (text == "")
{
obfusticateArea(display, image, bounds);
return;
}
gc = new GC(image);
gc.setBackground(display.getSystemColor(1));
gc.setForeground(display.getSystemColor(3));
gc.fillRectangle(bounds);
gc.drawRectangle(bounds);
gc.setClipping(bounds);
gc.drawText(text, bounds.x + 2, bounds.y + 1);
gc.dispose();
break MISSING_BLOCK_LABEL_105;
Exception exception;
exception;
gc.dispose();
throw exception;
}
public static void obfusticateArea(Image image, Control control, Point shellOffset, String text)
{
Rectangle bounds = control.getBounds();
Point offset = control.getParent().toDisplay(bounds.x, bounds.y);
bounds.x = offset.x - shellOffset.x;
bounds.y = offset.y - shellOffset.y;
obfusticateArea(control.getDisplay(), image, bounds, text);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -