diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-24 17:44:56 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-09-24 17:44:56 -0400 |
commit | f84def385d3d1b537e7f19b6ae1f90096e136505 (patch) | |
tree | 527bd3f68f6a6c27793a872e828ccc4a2e7a78e5 | |
parent | cb1f11a8462f3db34812ecbfb06227d3a2081d7f (diff) | |
download | SMAPI-f84def385d3d1b537e7f19b6ae1f90096e136505.tar.gz SMAPI-f84def385d3d1b537e7f19b6ae1f90096e136505.tar.bz2 SMAPI-f84def385d3d1b537e7f19b6ae1f90096e136505.zip |
sort update-check trace logs (#361)
-rw-r--r-- | src/StardewModdingAPI/Program.cs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 8a337562..3e1db20c 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -554,27 +554,35 @@ namespace StardewModdingAPI // fetch results this.Monitor.Log($"Checking for updates to {modsByKey.Count} keys...", LogLevel.Trace); - IDictionary<string, ModInfoModel> response = client.GetModInfoAsync(modsByKey.Keys.ToArray()).Result; + var results = + ( + from entry in client.GetModInfoAsync(modsByKey.Keys.ToArray()).Result + let mod = modsByKey[entry.Key] + orderby mod.DisplayName + select new { entry.Key, Mod = modsByKey[entry.Key], Info = entry.Value } + ) + .ToArray(); IDictionary<IModMetadata, ModInfoModel> updatesByMod = new Dictionary<IModMetadata, ModInfoModel>(); - foreach (var entry in response) + foreach (var result in results) { - IModMetadata mod = modsByKey[entry.Key]; + IModMetadata mod = result.Mod; + ModInfoModel info = result.Info; // handle error - if (entry.Value.Error != null) + if (info.Error != null) { - this.Monitor.Log($" {mod.DisplayName} ({entry.Key}): update error: {entry.Value.Error}", LogLevel.Trace); + this.Monitor.Log($" {mod.DisplayName} ({result.Key}): update error: {info.Error}", LogLevel.Trace); continue; } // track update - ISemanticVersion version = new SemanticVersion(entry.Value.Version); + ISemanticVersion version = new SemanticVersion(info.Version); bool isUpdate = version.IsNewerThan(mod.Manifest.Version); - this.VerboseLog($" {mod.DisplayName} ({entry.Key}): {(isUpdate ? $"update to {entry.Value.Version} found" : "OK")}."); + this.VerboseLog($" {mod.DisplayName} ({result.Key}): {(isUpdate ? $"{mod.Manifest.Version} => {info.Version}" : "OK")}."); if (isUpdate) { if (!updatesByMod.TryGetValue(mod, out ModInfoModel other) || version.IsNewerThan(other.Version)) - updatesByMod[mod] = entry.Value; + updatesByMod[mod] = info; } } |