Skip to content

Commit

Permalink
fix: Code generation of WebFile fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxGalaxy committed Dec 9, 2023
1 parent 85414f4 commit a542dba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/com/dragon/ide/objects/WebFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ public void setRawCode(String rawCode) {
this.rawCode = rawCode;
}

public String getCode() {
public String getCode(ArrayList<Event> events) {
String fileRawCode = new String(getRawCode());
if (!(getFileType() == WebFile.SupportedFileType.FOLDER)) {
for (int i = 0; i < getEvents().size(); ++i) {
for (int i = 0; i < events.size(); ++i) {
String formatter = "";
String[] lines = getRawCode().split("\n");
for (int i2 = 0; i2 < lines.length; ++i2) {
if (lines[i2].contains(getEvents().get(i).getEventReplacer())) {
if (lines[i2].contains(events.get(i).getEventReplacer())) {
formatter =
lines[i2].substring(
0,
lines[i2].indexOf(
CodeReplacer.getReplacer(getEvents().get(i).getEventReplacer())));
CodeReplacer.getReplacer(events.get(i).getEventReplacer())));
}
}

String eventCode = getEvents().get(i).getFormattedCode(formatter);
String eventReplacer = getEvents().get(i).getEventReplacer();
String eventCode = events.get(i).getFormattedCode(formatter);
String eventReplacer = events.get(i).getEventReplacer();
fileRawCode = fileRawCode.replaceAll(CodeReplacer.getReplacer(eventReplacer), eventCode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public boolean onOptionsItemSelected(MenuItem arg0) {
break;
}
ShowSourceCodeDialog showSourceCodeDialog =
new ShowSourceCodeDialog(this, file.getCode(), language);
new ShowSourceCodeDialog(this, file.getCode(eventList), language);
showSourceCodeDialog.show();
}
}
Expand Down

0 comments on commit a542dba

Please sign in to comment.