Exemple #1
0
        /// <summary>
        /// Creates all custom kneeboard images and returns them as a dictionary of byte arrays.
        /// </summary>
        /// <param name="mission">An HQ4DCS mission.</param>
        /// <returns>A dictionary of entries to include the .miz file. Key is the entry name, value is an array holding the bytes of the entry.</returns>
        public Dictionary <string, byte[]> MakeKneeboardImages(DCSMission mission)
        {
            Dictionary <string, byte[]> kneeboardImages = new Dictionary <string, byte[]>();

            DebugLog.Instance.Log($"Adding kneeboard images...");

            Image kneeboardImage = null;

            using (HTMLExporter htmlExporter = new HTMLExporter())
            { kneeboardImage = htmlExporter.ExportToImage(mission.BriefingHTML); }
            if (kneeboardImage == null)
            {
                return(kneeboardImages);                        // Failed to generate an image, abort
            }
            // TODO: format is wrong - should be 768x1024
            // TODO: briefing should be split in multiple pages to make sure even long briefings are readable
            foreach (string acType in mission.UsedPlayerAircraftTypes)
            {
                kneeboardImages.Add($"KNEEBOARD/{acType}/IMAGES/01.png", HQTools.ImageToBytes(kneeboardImage, ImageFormat.Png));
            }

            return(kneeboardImages);
        }