mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 08:17:17 +00:00
File cache improvement, deleting old temp files
This commit is contained in:
@@ -155,6 +155,21 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
super(JSplitPane.HORIZONTAL_SPLIT);
|
||||
this.mainPanel = mainPanel;
|
||||
this.flashPanel = flashPanel;
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(){
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(tempFile!=null){
|
||||
try{
|
||||
tempFile.delete();
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
@@ -464,7 +479,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
if (tempFile != null) {
|
||||
tempFile.delete();
|
||||
}
|
||||
tempFile = File.createTempFile("temp", ".swf");
|
||||
tempFile = File.createTempFile("ffdec_view_", ".swf");
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
Color backgroundColor = View.swfBackgroundColor;
|
||||
@@ -937,8 +952,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
tempFile.delete();
|
||||
}
|
||||
try {
|
||||
tempFile = File.createTempFile("temp", ".swf");
|
||||
tempFile.deleteOnExit();
|
||||
tempFile = File.createTempFile("ffdec_view_", ".swf");
|
||||
swf.saveTo(new BufferedOutputStream(new FileOutputStream(tempFile)));
|
||||
flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, swf.frameRate);
|
||||
} catch (IOException iex) {
|
||||
|
||||
Reference in New Issue
Block a user