private static bool AddLuaFileToEntries(Dictionary <string, byte[]> mizFileEntries, string mizEntryKey, string sourceFile, DCSMission mission = null) { if (string.IsNullOrEmpty(mizEntryKey) || mizFileEntries.ContainsKey(mizEntryKey) || string.IsNullOrEmpty(sourceFile)) { return(false); } sourceFile = $"{BRPaths.INCLUDE_LUA}{sourceFile}"; if (!File.Exists(sourceFile)) { return(false); } string luaContent = File.ReadAllText(sourceFile); if (mission != null) // A mission was provided, do the required replacements in the file. { luaContent = mission.ReplaceValues(luaContent); } foreach (Match match in Regex.Matches(luaContent, "\\$.*?\\$")) { BriefingRoom.PrintToLog($"Found a non-assigned value ({match.Value}) in Lua file \"{mizEntryKey}\".", LogMessageErrorLevel.Warning); } luaContent = Regex.Replace(luaContent, "\\$.*?\\$", "0"); mizFileEntries.Add(mizEntryKey, Encoding.UTF8.GetBytes(luaContent)); return(true); }