public static string ExportMissionToJson(FoundryMission mission, Formatting formatting = Formatting.Indented) { var json = JsonConvert.SerializeObject(mission, formatting, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, //DefaultValueHandling = DefaultValueHandling.Ignore, }); return(json); }
public static FoundryMission ParseMissionText(string txt) { var importLines = new List <string>(txt.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); var mission = new FoundryMission(); mission.Namespace = importLines.Find(s => s.StartsWith(Constants.FoundryMission.NameSpace)).Replace(Constants.FoundryMission.NameSpace, string.Empty); mission.Project = GetProject(importLines); mission.Mission = GetMission(importLines); mission.Maps = GetMaps(importLines); mission.Components = GetComponents(importLines); mission.Costumes = GetCostumes(importLines); return(mission); }