Skip to content

Commit

Permalink
Fixed problems with statistics tracker continually prompting for perm…
Browse files Browse the repository at this point in the history
…ission.

Fixed problem parsing statistics file generated by the core in the gamesmanager.
Fixed problem parsing successfull statistics submission response.
  • Loading branch information
mrsharpoblunto committed Sep 25, 2014
1 parent 326ba18 commit 47d4a8e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ public static string ReadOptionalValue(this JObject json, string name)

public static string ReadRequiredValue(this JToken json, string name)
{
string result = json[name].Value<string>();
if (string.IsNullOrEmpty(result)) throw new Exception("Required attribute '" + name + "' missing");
return result;
if (json[name] == null) throw new Exception("Required attribute '" + name + "' missing");
return json[name].Value<string>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void Dispose()

protected override void Load(JObject json)
{
var game = json["game"].First;
var game = json["game"];
if (game!=null)
{
var gameSource = new GameSettings
Expand All @@ -71,7 +71,7 @@ protected override void Load(JObject json)
};
if (game["statisticsserviceenabled"]!=null)
{
gameSource.StatisticsServiceEnabled = bool.Parse(game["statisticsserviceenabled"].Value<string>());
gameSource.StatisticsServiceEnabled = game["statisticsserviceenabled"].Value<bool>();
}
Settings = gameSource;
}
Expand All @@ -93,7 +93,8 @@ public void Save()
writer.WriteRequiredValue("uid", Settings.GameUid);
if (Settings.StatisticsServiceEnabled.HasValue)
{
writer.WriteRequiredValue("statisticsserviceenabled", Settings.StatisticsServiceEnabled.ToString());
writer.WritePropertyName("statisticsserviceenabled");
writer.WriteValue(Settings.StatisticsServiceEnabled.Value);
}
writer.WriteRequiredValue("username", Settings.UserName ?? string.Empty);
writer.WriteRequiredValue("passwordhash",DPAPI.Encrypt(Settings.Password ?? string.Empty));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public StatisticsSession(string gameUid,string serviceUrl,string filename)
{
do
{
string line = reader.ReadLine();
string line = reader.ReadLine().Trim();
if (string.IsNullOrEmpty(line)) continue;

int index = line.IndexOf(' ');
string[] prefix = line.Substring(0,index).Split(new[]{':'});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public List<string> Errors
}

[DataMember]
public bool Success { get { return _errors.Count == 0; } }
public bool Success { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
{
try
{
Uri statisticsPrviacyPolicy = new Uri(_game.StatisticsPrivacyPolicy);
Process.Start(statisticsPrviacyPolicy.ToString());
Uri statisticsPrivacyPolicy = new Uri(_game.StatisticsPrivacyPolicy);
Process.Start(statisticsPrivacyPolicy.ToString());
}
catch (Exception)
{
Expand Down

0 comments on commit 47d4a8e

Please sign in to comment.