mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-09-29 20:10:30 +02: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.control.RadioMenuItem;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.scene.layout.FlowPane;
|
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.flowless.VirtualizedScrollPane;
|
||||||
import org.fxmisc.richtext.StyleClassedTextArea;
|
import org.fxmisc.richtext.StyleClassedTextArea;
|
||||||
import org.fxmisc.richtext.model.StyleSpansBuilder;
|
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.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -61,7 +66,7 @@ public class UiLoggerController implements Initializable {
|
|||||||
public RadioMenuItem chkAntiSpam_medium;
|
public RadioMenuItem chkAntiSpam_medium;
|
||||||
public RadioMenuItem chkAntiSpam_high;
|
public RadioMenuItem chkAntiSpam_high;
|
||||||
public RadioMenuItem chkAntiSpam_ultra;
|
public RadioMenuItem chkAntiSpam_ultra;
|
||||||
public Label lblSkipped;
|
public Label lblFiltered;
|
||||||
|
|
||||||
private Map<Integer, LinkedList<Long>> filterTimestamps = new HashMap<>();
|
private Map<Integer, LinkedList<Long>> filterTimestamps = new HashMap<>();
|
||||||
|
|
||||||
@ -70,7 +75,7 @@ public class UiLoggerController implements Initializable {
|
|||||||
private Stage stage;
|
private Stage stage;
|
||||||
private PacketInfoManager packetInfoManager = null;
|
private PacketInfoManager packetInfoManager = null;
|
||||||
|
|
||||||
private int skipped = 0;
|
private int filteredAmount = 0;
|
||||||
|
|
||||||
private volatile boolean initialized = false;
|
private volatile boolean initialized = false;
|
||||||
private final List<Element> appendLater = new ArrayList<>();
|
private final List<Element> appendLater = new ArrayList<>();
|
||||||
@ -196,7 +201,7 @@ public class UiLoggerController implements Initializable {
|
|||||||
if (isIncoming && !isBlocked && !isReplaced) {
|
if (isIncoming && !isBlocked && !isReplaced) {
|
||||||
boolean filter = checkFilter(packet);
|
boolean filter = checkFilter(packet);
|
||||||
if (filter) {
|
if (filter) {
|
||||||
skipped++;
|
filteredAmount++;
|
||||||
updateLoggerInfo();
|
updateLoggerInfo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -322,7 +327,7 @@ public class UiLoggerController implements Initializable {
|
|||||||
lblViewIncoming.setText("View Incoming: " + (chkViewIncoming.isSelected() ? "True" : "False"));
|
lblViewIncoming.setText("View Incoming: " + (chkViewIncoming.isSelected() ? "True" : "False"));
|
||||||
lblViewOutgoing.setText("View Outgoing: " + (chkViewOutgoing.isSelected() ? "True" : "False"));
|
lblViewOutgoing.setText("View Outgoing: " + (chkViewOutgoing.isSelected() ? "True" : "False"));
|
||||||
lblAutoScrolll.setText("Autoscroll: " + (chkAutoscroll.isSelected() ? "True" : "False"));
|
lblAutoScrolll.setText("Autoscroll: " + (chkAutoscroll.isSelected() ? "True" : "False"));
|
||||||
lblSkipped.setText("Skipped: " + skipped);
|
lblFiltered.setText("Filtered: " + filteredAmount);
|
||||||
|
|
||||||
boolean packetInfoAvailable = packetInfoManager.getPacketInfoList().size() > 0;
|
boolean packetInfoAvailable = packetInfoManager.getPacketInfoList().size() > 0;
|
||||||
lblPacketInfo.setText("Packet info: " + (packetInfoAvailable ? "True" : "False"));
|
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());
|
File file = fileChooser.showSaveDialog(parentController.getStage());
|
||||||
|
|
||||||
if(file != null){
|
if(file != null){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileWriter fileWriter = new FileWriter(file);
|
FileWriter fileWriter = new FileWriter(file);
|
||||||
BufferedWriter out = new BufferedWriter(fileWriter);
|
BufferedWriter out = new BufferedWriter(fileWriter);
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
<CheckMenuItem fx:id="chkSkipBigPackets" mnemonicParsing="false" selected="true" text="Skip big packets" />
|
<CheckMenuItem fx:id="chkSkipBigPackets" mnemonicParsing="false" selected="true" text="Skip big packets" />
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#exportAll" text="Export all" />
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
</MenuBar>
|
</MenuBar>
|
||||||
@ -115,7 +116,7 @@
|
|||||||
<Insets right="10.0" />
|
<Insets right="10.0" />
|
||||||
</FlowPane.margin>
|
</FlowPane.margin>
|
||||||
</Label>
|
</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>
|
</FlowPane>
|
||||||
</bottom>
|
</bottom>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
Loading…
Reference in New Issue
Block a user