public static bool SaveMapMetaData(MapMetaData metaData)
        {
            if (metaData == null)
            {
                return(false);
            }

            try
            {
                CreateMetaDataFolder();

                string fileName   = metaData.GetJsonFileName();
                string pathToFile = Path.Combine(FullPathToMetaFolder, fileName);


                string jsonToSave = JsonConvert.SerializeObject(metaData, Formatting.Indented);

                File.WriteAllText(pathToFile, jsonToSave);
                return(true);
            }
            catch (Exception e)
            {
                Logger.Error(e, "failed to save map meta data");
                return(false);
            }
        }
        public static BoolWithMessage DeleteMapFiles(MapMetaData metaData)
        {
            if (metaData == null)
            {
                return(BoolWithMessage.False($"meta data is null"));
            }

            if (metaData.FilePaths?.Count == 0)
            {
                return(BoolWithMessage.False($"List of files to delete is unknown for {metaData.MapName}. You must manually delete the map files from the following folder: {metaData.MapFileDirectory}"));
            }

            try
            {
                BoolWithMessage result = FileUtils.DeleteFiles(metaData.FilePaths);

                if (result.Result == false)
                {
                    return(result);
                }

                // lastly delete meta data file
                string pathToMetaData = Path.Combine(MetaDataManager.FullPathToMetaFolder, metaData.GetJsonFileName());
                if (File.Exists(pathToMetaData))
                {
                    File.Delete(pathToMetaData);
                }

                return(BoolWithMessage.True($"{metaData.MapName} has been deleted!"));
            }
            catch (Exception e)
            {
                return(BoolWithMessage.False($"Failed to delete files: {e.Message}"));
            }
        }
        public void Test_SaveMapMetaData_Saves_Correct_Json()
        {
            SessionPath.ToSession = TestPaths.ToSessionTestFolder;

            MapMetaData testMetaData = new MapMetaData()
            {
                FilePaths = new List <string>()
                {
                    "test1", "test2"
                },
                CustomName         = "Test Custom Name",
                MapName            = "MapName",
                IsHiddenByUser     = false,
                OriginalImportPath = "",
                MapFileDirectory   = "Path\\To\\Content\\MapName_Folder"
            };

            MetaDataManager.SaveMapMetaData(testMetaData);

            string pathToSavedFile = Path.Combine(MetaDataManager.FullPathToMetaFolder, testMetaData.GetJsonFileName());

            Assert.AreEqual(Newtonsoft.Json.JsonConvert.SerializeObject(testMetaData), File.ReadAllText(pathToSavedFile));
        }