From c0be41611a15108fc23bc111efa290134b6d4e67 Mon Sep 17 00:00:00 2001 From: groot Date: Sun, 29 May 2016 14:32:00 -0700 Subject: [PATCH] First pass at updating MA Parser to Find ObjectId for #42 --- SpaceBattleArena.config | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/SpaceBattleArena.config b/SpaceBattleArena.config index 2ebe46f..f4d9399 100644 --- a/SpaceBattleArena.config +++ b/SpaceBattleArena.config @@ -35,12 +35,29 @@ message SBAEntry with override string ToString() { return Message; + } +} + +int get ObjectId(this SBAEntry msg) +{ + int s = msg.Message.IndexOf("#"); + + if (s > -1) + { + // TODO: Find end of Number + string ret = msg.Message.Segment(s+1, 3); + + return (ret as int); } + + return -1; } +//syntax FindObjectID = regex{#\d+}; + syntax CustomDateTimeFormat = year:regex{\d\d\d\d} "-" month:regex{\d\d} "-" day:regex{\d\d} " " hours:regex{\d\d} ":" minutes:regex{\d\d} ":" seconds:regex{\d\d} "," milliseconds:regex{\d\d\d} => ToDateTime(year + "-" + month + "-" + day + "T" + hours + ":" + minutes + ":" + seconds + "." + milliseconds, DateTimeStyles.None); -DateTime get customDateTime(this SBAEntry msg) with EntryFieldInfo {IsTimestamp = true, IsLocalTime = true } +DateTime get customSBAPythonDateTime(this SBAEntry msg) with EntryFieldInfo {IsTimestamp = true, IsLocalTime = true } { optional DateTime theDateTime = CustomDateTimeFormat(msg.timestamp);