package skadistats.clarity.examples.test;

import com.google.protobuf.GeneratedMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import skadistats.clarity.processor.entities.UsesEntities;
import skadistats.clarity.processor.reader.OnMessage;
import skadistats.clarity.processor.runner.Context;
import skadistats.clarity.processor.runner.ControllableRunner;
import skadistats.clarity.source.MappedFileSource;
import skadistats.clarity.wire.s1.proto.S1NetMessages;
import skadistats.clarity.wire.s2.proto.S2NetMessages;

@UsesEntities
public class Main {

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

    @OnMessage(GeneratedMessage.class)
    public void onMessage(Context ctx, GeneratedMessage message) {
        if (message instanceof S1NetMessages.CSVCMsg_VoiceData || message instanceof S2NetMessages.CSVCMsg_VoiceData) {
            return;
        }
        log.info("{}: {}", ctx.getTick(), message.getClass().getSimpleName());
    }

    public void runSeek(String[] args) throws Exception {
        ControllableRunner runner = new ControllableRunner(new MappedFileSource(args[0])).runWith(this);
        runner.seek(0);
        runner.seek(3000);
        System.out.println("at 3000");
        runner.seek(0);
        System.out.println("at 0");
        runner.halt();
    }

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

}

@@ -40,53 +40,8 @@
 t;%0A%0A
-import com.google.protobuf.GeneratedMessage;%0A
 impo
@@ -156,114 +156,8 @@
 es;%0A
-import skadistats.clarity.processor.reader.OnMessage;%0Aimport skadistats.clarity.processor.runner.Context;%0A
 impo
@@ -269,118 +269,8 @@
 rce;
-%0Aimport skadistats.clarity.wire.s1.proto.S1NetMessages;%0Aimport skadistats.clarity.wire.s2.proto.S2NetMessages;
 %0A%0A@U
@@ -395,16 +395,18 @@
 ss());%0A%0A
+//
     @OnM
@@ -436,16 +436,18 @@
 .class)%0A
+//
     publ
@@ -501,24 +501,26 @@
  message) %7B%0A
+//
         if (
@@ -627,16 +627,18 @@
 Data) %7B%0A
+//
         
@@ -649,16 +649,18 @@
 return;%0A
+//
         
@@ -661,16 +661,18 @@
       %7D%0A
+//
         
@@ -742,22 +742,26 @@
 ame());%0A
+//
     %7D%0A
+//
 %0A    pub
@@ -920,32 +920,8 @@
 s);%0A
-        runner.seek(0);%0A
     

refactor seeking