From 87f43a8e7a40eb2ff302e9030c96e030c49075db Mon Sep 17 00:00:00 2001 From: natekomodo Date: Sat, 6 Feb 2021 04:39:10 +0000 Subject: [PATCH] make channel order consistent --- DiscordToMoon/Writers/DiscordImageWriter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DiscordToMoon/Writers/DiscordImageWriter.cs b/DiscordToMoon/Writers/DiscordImageWriter.cs index e6d3b5f..3e90252 100644 --- a/DiscordToMoon/Writers/DiscordImageWriter.cs +++ b/DiscordToMoon/Writers/DiscordImageWriter.cs @@ -14,8 +14,10 @@ public sealed class DiscordImageWriter : ImageWriter public DiscordImageWriter(string jsonFolder) { - _manifest = new JsonLoader(Directory.GetFiles(jsonFolder)).FromDiscord(); - + _manifest = new JsonLoader(Directory.GetFiles(jsonFolder)).FromDiscord() + .OrderBy(obj => obj.Key) + .ToDictionary(obj => obj.Key, obj => obj.Value); + long characters = _manifest.Values.Select(l => l.Select(s => s.Length).Sum()).Sum() + _manifest.Keys.Select(s => s.Length + 2).Sum(); var pixels = (int)Math.Ceiling((characters / 3f));