Skip to content

Commit

Permalink
Merge pull request #28 from ReddoKiddo/master
Browse files Browse the repository at this point in the history
Fix for coords.txt invalid coordinate error
  • Loading branch information
NecronomiconCoding authored Jul 22, 2016
2 parents 9f0df8c + c8fec2e commit 175d090
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions PokemonGo.RocketAPI/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ public class Client
public Client(ISettings settings)
{
Settings = settings;
if (File.Exists(Directory.GetCurrentDirectory() + "\\Coords.txt"))
if (File.Exists(Directory.GetCurrentDirectory() + "\\Coords.txt") && File.ReadAllText(Directory.GetCurrentDirectory() + "\\Coords.txt").Contains(":"))
{
var latlngFromFile = File.ReadAllText(Directory.GetCurrentDirectory() + "\\Coords.txt");
var latlng = latlngFromFile.Split(':');
SetCoordinates(Convert.ToDouble(latlng[0]), Convert.ToDouble(latlng[1]), Settings.DefaultAltitude);
if (latlng[0].Length != 0 && latlng[1].Length != 0)
{
SetCoordinates(Convert.ToDouble(latlng[0]), Convert.ToDouble(latlng[1]), Settings.DefaultAltitude);
}
else
{
SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
}
}
else
{
Expand Down

0 comments on commit 175d090

Please sign in to comment.