Exemple #1
0
        internal static byte[] ExportToMizBytes(DCSMission mission)
        {
            Dictionary <string, byte[]> MizFileEntries = new Dictionary <string, byte[]>();

            AddStringValueToEntries(MizFileEntries, "briefing.html", mission.Briefing.GetBriefingAsHTML(true));
            AddStringValueToEntries(MizFileEntries, "credits.txt", "Generated with BriefingRoom for DCS World (https://akaagar.itch.io/briefing-room-for-dcs)");
            AddLuaFileToEntries(MizFileEntries, "mission", "Mission.lua", mission);
            AddLuaFileToEntries(MizFileEntries, "options", "Options.lua", null);
            AddStringValueToEntries(MizFileEntries, "theatre", mission.GetValue("TheaterID"));
            AddLuaFileToEntries(MizFileEntries, "warehouses", "Warehouses.lua", mission);

            AddLuaFileToEntries(MizFileEntries, "l10n/DEFAULT/dictionary", "Dictionary.lua", null);
            AddLuaFileToEntries(MizFileEntries, "l10n/DEFAULT/mapResource", "MapResource.lua", mission);
            AddLuaFileToEntries(MizFileEntries, "l10n/DEFAULT/script.lua", "Script.lua", mission);

            foreach (string mediaFile in mission.GetMediaFileNames())
            {
                byte[] fileBytes = mission.GetMediaFile(mediaFile);
                if (fileBytes == null)
                {
                    continue;
                }
                MizFileEntries.Add(mediaFile, fileBytes);
            }

            return(Toolbox.ZipData(MizFileEntries));
        }