Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Added header length to project-info
Browse files Browse the repository at this point in the history
  • Loading branch information
Petschko committed Mar 15, 2021
1 parent 7f2e5a8 commit f96979d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/petschko/rpgmakermv/decrypt/gui/GUI.java
Expand Up @@ -285,7 +285,9 @@ void changeHeaderSignature() {
boolean changes = false;

if(headerLen.getText().matches("[0-9]+")) {
getDecrypter().setHeaderLen(Integer.parseInt(headerLen.getText()));
int headerLength = Integer.parseInt(headerLen.getText());
getDecrypter().setHeaderLen(headerLength);
projectInfo.setHeaderLen(headerLength);
changes = true;
} else
errors.add("Header Length can be only numbers!");
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/petschko/rpgmakermv/decrypt/gui/ProjectInfo.java
Expand Up @@ -19,6 +19,7 @@ class ProjectInfo extends JPanel {
private JPanel projectFile = new JPanel(new GridLayout(1, 2));
private JPanel systemFile = new JPanel(new GridLayout(1, 2));
private JPanel jEncryptionKey = new JPanelLine();
private JPanel jHeaderLen = new JPanelLine();
private JPanel jSignature = new JPanelLine();
private JPanel jVersion = new JPanelLine();
private JPanel jRemain = new JPanelLine();
Expand All @@ -29,6 +30,7 @@ class ProjectInfo extends JPanel {
private boolean hasProjectFile = false;
private boolean hasSystemFile = false;
private String encryptionKey = null;
private int headerLen = 0;
private String signature = null;
private String version = null;
private String remain = null;
Expand Down Expand Up @@ -93,6 +95,15 @@ void setEncryptionKey(String encryptionKey) {
this.encryptionKey = encryptionKey;
}

/**
* Sets the Header-Len
*
* @param headerLen - Header-Len
*/
public void setHeaderLen(int headerLen) {
this.headerLen = headerLen;
}

/**
* Sets the Header-Signature
*
Expand Down Expand Up @@ -145,6 +156,7 @@ void setValuesFromDecrypter(Decrypter decrypter) {
return;

this.encryptionKey = decrypter.getDecryptCode();
this.headerLen = decrypter.getHeaderLen();
this.signature = decrypter.getSignature();
this.version = decrypter.getVersion();
this.remain = decrypter.getRemain();
Expand All @@ -161,6 +173,7 @@ private void removeAllLayouts() {
projectFile.removeAll();
systemFile.removeAll();
jEncryptionKey.removeAll();
jHeaderLen.removeAll();
jSignature.removeAll();
jVersion.removeAll();
jRemain.removeAll();
Expand Down Expand Up @@ -212,6 +225,12 @@ private void buildContent() {
keyLabel.setForeground(Color.RED);
this.jEncryptionKey.add(keyLabel);

this.jHeaderLen.add(new JLabel("Header-Length: "));
JLabel headerLabel = new JLabel(String.valueOf(this.headerLen));
if(this.headerLen == 0)
headerLabel.setForeground(Color.RED);
this.jHeaderLen.add(headerLabel);

this.jSignature.add(new JLabel("Signature: "));
JLabel signatureLabel = new JLabel(this.signature == null ? "-" : this.signature);
if(this.signature == null)
Expand All @@ -237,6 +256,7 @@ private void buildContent() {
this.mainInfo.validate();

this.keyInfo.add(this.jEncryptionKey);
this.keyInfo.add(this.jHeaderLen);
this.keyInfo.add(this.jSignature);
this.keyInfo.add(this.jVersion);
this.keyInfo.add(this.jRemain);
Expand All @@ -260,6 +280,7 @@ void reset() {
hasProjectFile = false;
hasSystemFile = false;
encryptionKey = null;
headerLen = 0;
signature = null;
version = null;
remain = null;
Expand Down

0 comments on commit f96979d

Please sign in to comment.