package skadistats.clarity.examples.test;

import com.google.protobuf.ByteString;
import com.google.protobuf.GeneratedMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import skadistats.clarity.processor.reader.OnMessageContainer;
import skadistats.clarity.processor.runner.Context;
import skadistats.clarity.processor.runner.SimpleRunner;
import skadistats.clarity.source.MappedFileSource;

public class Main {

    private final Logger log = LoggerFactory.getLogger(Main.class.getPackage().getClass());

    @OnMessageContainer
    public void onFullPacket(Context ctx, Class<? extends GeneratedMessage> messageClass, ByteString data) {
        System.out.println(messageClass.getName());
    }

    public void run(String[] args) throws Exception {
        long tStart = System.currentTimeMillis();
        new SimpleRunner(new MappedFileSource(args[0])).runWith(this);
        long tMatch = System.currentTimeMillis() - tStart;
        log.info("total time taken: {}s", (tMatch) / 1000.0);
    }

    public static void main(String[] args) throws Exception {
        new Main().run(args);
    }

}

@@ -40,47 +40,8 @@
 t;%0A%0A
-import com.google.protobuf.ByteString;%0A
 impo
@@ -190,25 +190,16 @@
 nMessage
-Container
 ;%0Aimport
@@ -485,17 +485,8 @@
 sage
-Container
 %0A   
@@ -527,24 +527,8 @@
 ctx,
- Class%3C? extends
  Gen
@@ -544,17 +544,16 @@
 sage
-%3E
  message
 Clas
@@ -552,30 +552,8 @@
 sage
-Class, ByteString data
 ) %7B%0A
@@ -560,16 +560,18 @@
         
+//
 System.o
@@ -588,21 +588,27 @@
 (message
+.get
 Class
+()
 .getName

add S2 packet types add unpacker for embedded packets in S2