package skadistats.clarity.examples.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import skadistats.clarity.model.GameEvent;
import skadistats.clarity.model.GameEventDescriptor;
import skadistats.clarity.processor.gameevents.OnGameEvent;
import skadistats.clarity.processor.gameevents.OnGameEventDescriptor;
import skadistats.clarity.processor.runner.Context;
import skadistats.clarity.processor.runner.ControllableRunner;
import skadistats.clarity.processor.stringtables.UsesStringTable;
import skadistats.clarity.source.MappedFileSource;

@UsesStringTable("instancebaseline")
public class Main {

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

    @OnGameEventDescriptor()
    public void onGameEventDescriptor(Context ctx, GameEventDescriptor descriptor) {
        System.out.println(descriptor);
    }

    @OnGameEvent
    public void onGameEvent(Context ctx, GameEvent event) {
        System.out.println(event);
    }

    public void run(String[] args) throws Exception {
        long tStart = System.currentTimeMillis();
        ControllableRunner runner = new ControllableRunner(new MappedFileSource(args[0])).runWith(this);
        runner.tick();
        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);
    }

}

@@ -311,32 +311,86 @@
 ventDescriptor;%0A
+import skadistats.clarity.processor.reader.OnMessage;%0A
 import skadistat
@@ -484,24 +484,86 @@
 ableRunner;%0A
+import skadistats.clarity.processor.sendtables.UsesDTClasses;%0A
 import skadi
@@ -666,16 +666,100 @@
 eSource;
+%0Aimport skadistats.clarity.wire.s2.proto.S2NetMessages;%0A%0Aimport java.io.IOException;
 %0A%0A@UsesS
@@ -774,26 +774,26 @@
 le(%22
-instancebaseline%22)
+*%22)%0A@UsesDTClasses
 %0Apub
@@ -903,16 +903,253 @@
 ss());%0A%0A
+    @OnMessage(S2NetMessages.CSVCMsg_CreateStringTable.class)%0A    public void onCreateStringTable(Context ctx, S2NetMessages.CSVCMsg_CreateStringTable message) throws IOException %7B%0A        //System.out.println(message.getName());%0A    %7D%0A%0A
     @OnG

add EngineType dependent providers move DTClass Generation into separate providers for S1 / S2