From 669ec6c7c3186ca0180206275f0a3fba09f64722 Mon Sep 17 00:00:00 2001
From: brennenstuhl <tobias.brennenstuhl.gy@nps.edu>
Date: Mon, 13 Apr 2020 14:47:06 -0700
Subject: [PATCH] Merge origin/master

Conflicts:
	Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
	Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
---
 .../src/PduStreamTools/PduListenerSaver.java  | 127 +++++++++---------
 .../src/PduStreamTools/PduReaderPlayer.java   |   7 +-
 2 files changed, 65 insertions(+), 69 deletions(-)

diff --git a/Brennenstuhl/src/PduStreamTools/PduListenerSaver.java b/Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
index 380122c..9ce3d5c 100644
--- a/Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
+++ b/Brennenstuhl/src/PduStreamTools/PduListenerSaver.java
@@ -4,85 +4,80 @@
  */
 package PduStreamTools;
 
-import PduStreamTools.RecorderBinary;
 import java.io.IOException;
 import java.util.Scanner;
 
 /**
- * PduSaver.java created on Aug 21, 2019
- * MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
+ * PduSaver.java created on Aug 21, 2019 MOVES Institute Naval Postgraduate
+ * School, Monterey, CA, USA www.nps.edu
  *
  * @author Mike Bailey, jmbailey@nps.edu
  * @version $Id$
  */
-public class PduListenerSaver
-{
-  private final static String DEFAULT_OUTPUTDIR = "pduLog";
-  private final static String MCAST_ADDR = "239.1.2.3";
-  private final static int DIS_PORT = 3000;
+public class PduListenerSaver {
 
-  private enum mystate
-  {
-    RUNNING,
-    PAUSED;
-  }
+    private final static String DEFAULT_OUTPUTDIR = "pduLog";
+    private final static String MCAST_ADDR = "239.1.2.3";
+    private final static int DIS_PORT = 3000;
 
-  public static void main(String[] args) throws IOException
-  {
-    String outDir = DEFAULT_OUTPUTDIR;
-    String mcast = MCAST_ADDR;
-    int port = DIS_PORT;
-    
-    System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
-
-    switch (args.length) {
-      case 0:
-        break;
-      case 1:
-        outDir = args[0];
-        break;
-      case 3:
-        outDir = args[0];
-        mcast = args[1];
-        port = Integer.parseInt(args[2]);
-        break;
-      default:
-        System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
-        System.exit(1);
+    private enum mystate {
+        RUNNING,
+        PAUSED;
     }
 
-    System.out.println("Beginning pdu save to directory " + outDir);
-    //RecorderPlainText stores an unencoded PduLog
-    //RecorderPlainText recorder = new RecorderPlainText(outDir, mcast, port);
-    //RecorderBase64 stores a BASE64 encoded PduLog
-    //RecorderBase64 recorder = new RecorderBase64(outDir, mcast, port);
-    //RecorderBinary stores a Binary PduLog
-    RecorderBinary recorder = new RecorderBinary(outDir, mcast, port);
-    
-    recorder.startResume();
-    mystate state = mystate.RUNNING;
-    System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
-    Scanner scan = new Scanner(System.in);
-    while (true) {
-        System.out.println("Warning: you must quit when complete, otherwise recorded PDUs are lost!");
-        System.out.println("Type p/enter to pause, r/enter to resume, q/enter to stop recording, save and quit");
-        String line = scan.nextLine();
-        if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
-            recorder.stopPause();
-            state = mystate.PAUSED;
-            System.out.println("* recorder.stopPause(), state=PAUSED, recording paused...");
-        }
-        else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
-            recorder.startResume();
-            state = mystate.RUNNING;
-            System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
+    public static void main(String[] args) throws IOException {
+        String outDir = DEFAULT_OUTPUTDIR;
+        String mcast = MCAST_ADDR;
+        int port = DIS_PORT;
+
+        System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
+
+        switch (args.length) {
+            case 0:
+                break;
+            case 1:
+                outDir = args[0];
+                break;
+            case 3:
+                outDir = args[0];
+                mcast = args[1];
+                port = Integer.parseInt(args[2]);
+                break;
+            default:
+                System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
+                System.exit(1);
         }
-        else if (line.equalsIgnoreCase("q")) {
-            recorder.end();
-            System.out.println("* recorder.end(), recording complete.");
-            break;
+
+        System.out.println("Beginning pdu save to directory " + outDir);
+        //RecorderPlainText stores an unencoded PduLog
+        //RecorderPlainText recorder = new RecorderPlainText(outDir, mcast, port);
+        //RecorderBase64 stores a BASE64 encoded PduLog
+        //RecorderBase64 recorder = new RecorderBase64(outDir, mcast, port);
+        //RecorderBinary stores a Binary PduLog
+        RecorderBinary recorder = new RecorderBinary(outDir, mcast, port);
+
+        recorder.startResume();
+        mystate state = mystate.RUNNING;
+        System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
+        Scanner scan = new Scanner(System.in);
+        while (true) {
+            System.out.println("Warning: you must quit when complete, otherwise recorded PDUs are lost!");
+            System.out.println("Type p/enter to pause, r/enter to resume, q/enter to stop recording, save and quit");
+            String line = scan.nextLine();
+            if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
+                recorder.stopPause();
+                state = mystate.PAUSED;
+                System.out.println("* recorder.stopPause(), state=PAUSED, recording paused...");
+            } else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
+                recorder.startResume();
+                state = mystate.RUNNING;
+                System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
+            } else if (line.equalsIgnoreCase("q")) {
+                recorder.end();
+                System.out.println("* recorder.end(), recording complete.");
+                break;
+            }
         }
+        System.out.println("Ending pdu save to " + recorder.getLogFile());
     }
-    System.out.println("Ending pdu save to "+recorder.getLogFile());
-  }
 }
diff --git a/Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java b/Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
index 770d514..d4f7b94 100644
--- a/Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
+++ b/Brennenstuhl/src/PduStreamTools/PduReaderPlayer.java
@@ -53,10 +53,11 @@ public class PduReaderPlayer {
         try {
             //Use Tobis Code without decryption
             //Does only work with unecrypted PduLogs
-            PlayerPlainText player = new PlayerPlainText(mcast, port, new File(outDir).toPath());
-
+            //PlayerPlainText player = new PlayerPlainText(mcast, port, new File(outDir).toPath());
             //Use Mike Baileys Code to store a file in BASE64 format
-            //PlayerBase64 player = new PlayerBase64(mcast, port, new File(outDir).toPath());
+            PlayerBase64 player = new PlayerBase64(mcast, port, new File(outDir).toPath());
+            
+            
             player.startResume();
             mystate state = mystate.RUNNING;
             Scanner scan = new Scanner(System.in);
-- 
GitLab