Hex-Only-View
To enable hex-only-view: Set Pane 1 to the Hex-Viewer, then set Pane 2 & 3 to None
This commit is contained in:
parent
37df1802a9
commit
37a05d5959
2 changed files with 10 additions and 5 deletions
|
@ -67,7 +67,7 @@ import static the.bytecode.club.bytecodeviewer.util.MiscUtils.guessLanguage;
|
||||||
* http://the.bytecode.club
|
* http://the.bytecode.club
|
||||||
*
|
*
|
||||||
* TODO BUGS:
|
* TODO BUGS:
|
||||||
* + Switching from Dark to System theme crashes
|
* + Switching from Dark to System theme crashes (DarkLAF 2.6.1 works fine)
|
||||||
* + View>Visual Settings>Show Class Methods
|
* + View>Visual Settings>Show Class Methods
|
||||||
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
||||||
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case
|
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.commons.io.FilenameUtils;
|
||||||
import org.imgscalr.Scalr;
|
import org.imgscalr.Scalr;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||||
|
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.ImageJLabel;
|
import the.bytecode.club.bytecodeviewer.gui.components.ImageJLabel;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea;
|
import the.bytecode.club.bytecodeviewer.gui.components.SearchableRSyntaxTextArea;
|
||||||
import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor;
|
import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor;
|
||||||
|
@ -70,9 +71,12 @@ public class FileViewer extends ResourceViewer
|
||||||
final String nameLowerCase = this.resource.name.toLowerCase();
|
final String nameLowerCase = this.resource.name.toLowerCase();
|
||||||
final String onlyName = FilenameUtils.getName(nameLowerCase);
|
final String onlyName = FilenameUtils.getName(nameLowerCase);
|
||||||
final String contentsAsString = new String(contents);
|
final String contentsAsString = new String(contents);
|
||||||
|
final boolean hexViewerOnly = BytecodeViewer.viewer.viewPane1.getSelectedDecompiler() == Decompiler.HEXCODE_VIEWER &&
|
||||||
|
BytecodeViewer.viewer.viewPane2.getSelectedDecompiler() == Decompiler.NONE &&
|
||||||
|
BytecodeViewer.viewer.viewPane3.getSelectedDecompiler() == Decompiler.NONE;
|
||||||
|
|
||||||
//image viewer
|
//image viewer
|
||||||
if (!MiscUtils.isPureAscii(contentsAsString))
|
if (!MiscUtils.isPureAscii(contentsAsString) || hexViewerOnly)
|
||||||
{
|
{
|
||||||
//TODO:
|
//TODO:
|
||||||
// + Webp?
|
// + Webp?
|
||||||
|
@ -84,7 +88,8 @@ public class FileViewer extends ResourceViewer
|
||||||
|
|
||||||
//check by file extension to display image
|
//check by file extension to display image
|
||||||
if (!onlyName.contains(":") &&
|
if (!onlyName.contains(":") &&
|
||||||
ResourceType.imageExtensionMap.containsKey(FilenameUtils.getExtension(onlyName)))
|
ResourceType.imageExtensionMap.containsKey(FilenameUtils.getExtension(onlyName)) &&
|
||||||
|
!hexViewerOnly)
|
||||||
{
|
{
|
||||||
canRefresh = true;
|
canRefresh = true;
|
||||||
|
|
||||||
|
@ -108,9 +113,8 @@ public class FileViewer extends ResourceViewer
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//hex viewer
|
//hex viewer
|
||||||
else if (BytecodeViewer.viewer.forcePureAsciiAsText.isSelected())
|
else if (BytecodeViewer.viewer.forcePureAsciiAsText.isSelected() || hexViewerOnly)
|
||||||
{
|
{
|
||||||
JHexEditor hex = new JHexEditor(contents);
|
JHexEditor hex = new JHexEditor(contents);
|
||||||
mainPanel.add(hex);
|
mainPanel.add(hex);
|
||||||
|
@ -135,6 +139,7 @@ public class FileViewer extends ResourceViewer
|
||||||
{
|
{
|
||||||
if(src != null)
|
if(src != null)
|
||||||
src.setEnabled(true);
|
src.setEnabled(true);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue