/// <summary>
        /// Adds an entry to the .miz file.
        /// </summary>
        /// <param name="entryPath">The path to the entry in the .miz file.</param>
        /// <param name="text">The (UTF-8) text of the entry.</param>
        /// <returns>True if everything went well, false if an error happened.</returns>
        private bool AddMIZEntry(string entryPath, string text)
        {
            DebugLog.Instance.Log($"Adding text file {entryPath} to the .miz file");

            if (string.IsNullOrEmpty(text))
            {
                text = "";
            }
            else
            {
                text = text.Replace("\r\n", "\n");  // Convert CRLF end of lines to LF, CRLF can cause problems
            }
#if DEBUG
            // In debug builds, write all text entries to the DebugOutput path for easier debugging/comparisons
            string debugDumpFileName = entryPath.Replace('\\', '/').Replace('/', '_');
            if (Path.GetExtension(entryPath).Length == 0)
            {
                debugDumpFileName += ".lua";
            }
            HQTools.CreateDirectoryIfMissing(HQTools.PATH_DEBUG);
            File.WriteAllText(HQTools.PATH_DEBUG + debugDumpFileName, text);
#endif

            return(AddMIZEntry(entryPath, Encoding.UTF8.GetBytes(text)));
        }