Skip to content

Commit

Permalink
Forced decimal coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
5andr0 committed Jul 29, 2016
1 parent 22b43b2 commit 41d01f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions PogoLocationFeeder/Helper/MessageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public List<SniperInfo> 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);
Expand All @@ -33,7 +33,7 @@ public List<SniperInfo> parseMessage(string message)

private bool parseGeoCoordinates(string input)
{
Match match = Regex.Match(input, @"(?<lat>\-?\d+(\.\d+)?),\s*(?<long>\-?\d+(\.\d+)?)");
Match match = Regex.Match(input, @"(?<lat>\-?\d+(\.\d+)+),\s*(?<long>\-?\d+(\.\d+)+)");
if (match.Success)
{
sniperInfo.latitude = Convert.ToDouble(match.Groups["lat"].Value);
Expand Down
13 changes: 7 additions & 6 deletions PogoLocationFeeder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private string getIp(Socket s)

private DiscordClient _client;

private async Task feedToClients(List<SniperInfo> snipeList)
private async Task feedToClients(List<SniperInfo> snipeList, string channel)
{
// Remove any clients that have disconnected
arrSocket.RemoveAll(x => !IsConnected(x.Client));
Expand All @@ -106,15 +106,16 @@ private async Task feedToClients(List<SniperInfo> 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()
Expand All @@ -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());
}
};

Expand Down

0 comments on commit 41d01f4

Please sign in to comment.