From 41d01f4af3b8bd8c6433f5e0d1c7db602f2c4357 Mon Sep 17 00:00:00 2001 From: 5andr0 Date: Fri, 29 Jul 2016 11:50:55 +0200 Subject: [PATCH] Forced decimal coordinates --- PogoLocationFeeder/Helper/MessageParser.cs | 4 ++-- PogoLocationFeeder/Program.cs | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/PogoLocationFeeder/Helper/MessageParser.cs b/PogoLocationFeeder/Helper/MessageParser.cs index 598857a..785fc9b 100644 --- a/PogoLocationFeeder/Helper/MessageParser.cs +++ b/PogoLocationFeeder/Helper/MessageParser.cs @@ -18,7 +18,7 @@ public List parseMessage(string message) sniperInfo = new SniperInfo(); if (!parseGeoCoordinates(input)) { - Console.WriteLine($"Can't get coords from line: {input}"); + //Console.WriteLine($"Can't get coords from line: {input}"); // debug output, too much spam continue; } parseIV(input); @@ -33,7 +33,7 @@ public List parseMessage(string message) private bool parseGeoCoordinates(string input) { - Match match = Regex.Match(input, @"(?\-?\d+(\.\d+)?),\s*(?\-?\d+(\.\d+)?)"); + Match match = Regex.Match(input, @"(?\-?\d+(\.\d+)+),\s*(?\-?\d+(\.\d+)+)"); if (match.Success) { sniperInfo.latitude = Convert.ToDouble(match.Groups["lat"].Value); diff --git a/PogoLocationFeeder/Program.cs b/PogoLocationFeeder/Program.cs index 8b28ab6..7f29c5d 100644 --- a/PogoLocationFeeder/Program.cs +++ b/PogoLocationFeeder/Program.cs @@ -83,7 +83,7 @@ private string getIp(Socket s) private DiscordClient _client; - private async Task feedToClients(List snipeList) + private async Task feedToClients(List snipeList, string channel) { // Remove any clients that have disconnected arrSocket.RemoveAll(x => !IsConnected(x.Client)); @@ -106,15 +106,16 @@ private async Task feedToClients(List snipeList) } } // debug output - Console.WriteLine(target.timeStamp); - Console.WriteLine($"ID: {target.id}, Lat:{target.latitude}, Lng:{target.longitude}, IV:{target.iv}"); + Console.WriteLine($"Channel: {channel} ID: {target.id}, Lat:{target.latitude}, Lng:{target.longitude}, IV:{target.iv}"); + if (target.timeStamp != default(DateTime)) + Console.WriteLine($"Expires: {target.timeStamp}"); } } - private async Task relayMessageToClients(string message) + private async Task relayMessageToClients(string message, string channel) { var snipeList = parser.parseMessage(message); - await feedToClients(snipeList); + await feedToClients(snipeList, channel); } public void Start() @@ -131,7 +132,7 @@ public void Start() { if (settings.ServerChannels.Any(x => x.Equals(e.Channel.Name.ToString(), StringComparison.OrdinalIgnoreCase))) { - await relayMessageToClients(e.Message.Text); + await relayMessageToClients(e.Message.Text, e.Channel.Name.ToString()); } };