public void Parse() { var text = System.IO.File.ReadAllText(Path) + "\n"; this.Transpiler = new Transpiler(text, this.Project); this.Generator = Transpiler.Generator; this.LastParsed = DateTime.Now; if (Transpiler.Errors.Count == 0) { Console.WriteLine($"Perfectly parsed: {Name}"); SaveResult(Transpiler.XsdToString(), "Model.xsd"); SaveResult(Transpiler.HtmlToString(), "index.html"); foreach (var(key, value) in Transpiler.JsonToString()) { SaveResult(value, key); } } else { foreach (var error in Transpiler.Errors) { Console.WriteLine(error.Message); } } }
public void SaveModuleOutput() { this.Transpiler.StartMappings(); Console.WriteLine($"Perfectly parsed: {Name}"); SaveResult("Model.xsd", Transpiler.XsdToString()); SaveResult("index.html", Transpiler.HtmlToString()); foreach (var(key, value) in Transpiler.JsonToString()) { SaveResult(key, value); } // We would now also want to resolve the other modules // which depend upon this module so that they are automatically // regenerated and their output changed. this.Project .Modules .FindAll(m => m.References.FirstOrDefault(r => r == this.Name) != null) .ForEach(m => { m.Parse(); m.SaveModuleOutput(); }); }