private void RegenerateSchema(IFilePresenterTab filePresenterTab) { bool xml = true; foreach (FilePresenterButtonInfo buttonInfo in filePresenterTab.FilePresenterButtons) { if (buttonInfo.ButtonName == "bXML") { xml = buttonInfo.IsToggled; } if (buttonInfo.ButtonName == "bCompact") { xml = !buttonInfo.IsToggled; } } if (xml) { XDocument xmlSchemaDocument; var schemaGenerator = GenerateXmlSyntax(out xmlSchemaDocument, filePresenterTab.SourcePSMSchema); filePresenterTab.ReDisplayFile(xmlSchemaDocument, EDisplayedFileType.RNG, schemaGenerator.PSMSchema.Caption + ".rng", schemaGenerator.Log, sourcePSMSchema: schemaGenerator.PSMSchema); } else { XDocument xmlSchemaDocument; var schemaGenerator = GenerateXmlSyntax(out xmlSchemaDocument, filePresenterTab.SourcePSMSchema); StringBuilder sb = new StringBuilder(); TextWriter tw = new StringWriter(sb); schemaGenerator.WriteInCompactSyntax(xmlSchemaDocument, tw); sb.Insert(0, string.Format("# translated to compact syntax using Pantor Engineering AB's RngToRncClassic.xsl" + Environment.NewLine + Environment.NewLine)); sb.Insert(0, string.Format("# generated by eXolutio on {0} {1} from {2}/{3}. " + Environment.NewLine, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), filePresenterTab.SourcePSMSchema.Project.Name, filePresenterTab.SourcePSMSchema.Caption)); filePresenterTab.ReDisplayFile(sb.ToString(), EDisplayedFileType.RNC, schemaGenerator.PSMSchema.Caption + ".rnc", schemaGenerator.Log, sourcePSMSchema: schemaGenerator.PSMSchema); } }
private void RegenerateSchema(IFilePresenterTab filePresenterTab) { XDocument document; ILog log; TagClass tag = (TagClass)filePresenterTab.Tag; TranslationSettings settings = tag.settings; foreach (FilePresenterButtonInfo buttonInfo in filePresenterTab.FilePresenterButtons) { if (buttonInfo.ButtonName == "SA") { settings.SchemaAware = buttonInfo.IsToggled; } if (buttonInfo.ButtonName == "F") { settings.Functional = buttonInfo.IsToggled; } } settings.SubexpressionTranslations.Clear(); settings.Retranslation = false; GenerateSchema(filePresenterTab.SourcePSMSchema, settings, out document, out log); tag.tweakingPanel.Bind(settings.SubexpressionTranslations); filePresenterTab.ReDisplayFile(document, EDisplayedFileType.SCH, filePresenterTab.SourcePSMSchema.Caption, log, filePresenterTab.ValidationSchema, filePresenterTab.SourcePSMSchema); }