private static void MainLoop(string fileName, MumbleLink ml)
        {
            while (!ShouldExit())
            {
                MumbleLink.LinkedMem  state;
                MumbleLink.GW2Context context;
                ml.Read(out state, out context);

                string newContents = genContents(state, context);
                if (newContents != oldContents)
                {
                    File.WriteAllText(fileName, newContents);

                    DayNightCycle.TimeOfDay tod = DayNightCycle.Classify();
                    Console.WriteLine("{0}: Updated file: GW2MapId = {1}, "
                                      + "GW2TOD = {2}, GW2Active = {3}.",
                                      DateTime.Now,
                                      context.mapId, (int)tod, active ? 1 : 0);

                    oldContents = newContents;
                    Thread.Sleep(WriteDelayMs);
                }

                Thread.Sleep(PollIntervalMs);
            }
        }
        private static void MainLoop(string fileName, MumbleLink ml)
        {
            while (!ShouldExit())
            {
                MumbleLink.LinkedMem  state;
                MumbleLink.GW2Context context;
                ml.Read(out state, out context);

                string newContents = genContents(state, context);
                if (newContents != oldContents)
                {
                    File.WriteAllText(fileName, newContents);

                    DayNightCycle.TimeOfDay tod = DayNightCycle.Classify();

                    oldContents = newContents;
                    Thread.Sleep(WriteDelayMs);
                }
                Thread.Sleep(PollIntervalMs);
            }
        }