mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-02-17 03:32:36 +01:00
export all packets
This commit is contained in:
parent
e0ab62bb33
commit
455d30e045
@ -15,12 +15,17 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioMenuItem;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import org.fxmisc.flowless.VirtualizedScrollPane;
|
||||
import org.fxmisc.richtext.StyleClassedTextArea;
|
||||
import org.fxmisc.richtext.model.StyleSpansBuilder;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -61,7 +66,7 @@ public class UiLoggerController implements Initializable {
|
||||
public RadioMenuItem chkAntiSpam_medium;
|
||||
public RadioMenuItem chkAntiSpam_high;
|
||||
public RadioMenuItem chkAntiSpam_ultra;
|
||||
public Label lblSkipped;
|
||||
public Label lblFiltered;
|
||||
|
||||
private Map<Integer, LinkedList<Long>> filterTimestamps = new HashMap<>();
|
||||
|
||||
@ -70,7 +75,7 @@ public class UiLoggerController implements Initializable {
|
||||
private Stage stage;
|
||||
private PacketInfoManager packetInfoManager = null;
|
||||
|
||||
private int skipped = 0;
|
||||
private int filteredAmount = 0;
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final List<Element> appendLater = new ArrayList<>();
|
||||
@ -196,7 +201,7 @@ public class UiLoggerController implements Initializable {
|
||||
if (isIncoming && !isBlocked && !isReplaced) {
|
||||
boolean filter = checkFilter(packet);
|
||||
if (filter) {
|
||||
skipped++;
|
||||
filteredAmount++;
|
||||
updateLoggerInfo();
|
||||
return;
|
||||
}
|
||||
@ -322,7 +327,7 @@ public class UiLoggerController implements Initializable {
|
||||
lblViewIncoming.setText("View Incoming: " + (chkViewIncoming.isSelected() ? "True" : "False"));
|
||||
lblViewOutgoing.setText("View Outgoing: " + (chkViewOutgoing.isSelected() ? "True" : "False"));
|
||||
lblAutoScrolll.setText("Autoscroll: " + (chkAutoscroll.isSelected() ? "True" : "False"));
|
||||
lblSkipped.setText("Skipped: " + skipped);
|
||||
lblFiltered.setText("Filtered: " + filteredAmount);
|
||||
|
||||
boolean packetInfoAvailable = packetInfoManager.getPacketInfoList().size() > 0;
|
||||
lblPacketInfo.setText("Packet info: " + (packetInfoAvailable ? "True" : "False"));
|
||||
@ -363,4 +368,33 @@ public class UiLoggerController implements Initializable {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void exportAll(ActionEvent actionEvent) {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
|
||||
//Set extension filter
|
||||
FileChooser.ExtensionFilter extFilter =
|
||||
new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
|
||||
fileChooser.getExtensionFilters().add(extFilter);
|
||||
fileChooser.setTitle("Save Packets");
|
||||
|
||||
//Show save file dialog
|
||||
File file = fileChooser.showSaveDialog(stage);
|
||||
|
||||
if(file != null){
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter(file);
|
||||
BufferedWriter out = new BufferedWriter(fileWriter);
|
||||
|
||||
out.write(area.getText());
|
||||
|
||||
out.flush();
|
||||
out.close();
|
||||
fileWriter.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,6 @@ public class SchedulerController extends SubForm {
|
||||
File file = fileChooser.showSaveDialog(parentController.getStage());
|
||||
|
||||
if(file != null){
|
||||
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter(file);
|
||||
BufferedWriter out = new BufferedWriter(fileWriter);
|
||||
|
@ -67,6 +67,7 @@
|
||||
</items>
|
||||
</Menu>
|
||||
<CheckMenuItem fx:id="chkSkipBigPackets" mnemonicParsing="false" selected="true" text="Skip big packets" />
|
||||
<MenuItem mnemonicParsing="false" onAction="#exportAll" text="Export all" />
|
||||
</items>
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
@ -115,7 +116,7 @@
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Label fx:id="lblSkipped" layoutX="389.0" layoutY="11.0" style="-fx-text-fill: black !important" text="Skipped: 0" />
|
||||
<Label fx:id="lblFiltered" layoutX="389.0" layoutY="11.0" style="-fx-text-fill: black !important" text="Filtered: 0" />
|
||||
</FlowPane>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
|
Loading…
x
Reference in New Issue
Block a user