/// <summary> /// Save the applications topic, all subsequent child topics; also saves the Sandcastle content, /// token and project files. /// </summary> public override void Save() { TimerStart(); SaveTopic(); foreach (var topic in topics) { if (topic != null) { topic.Save(); } } //loopResult = Parallel.ForEach(topics, SaveAllTopics); base.Save(); //save content file and add to the project ContentFile.GetContentFile().AddApplicationTopic(GetContentLayout()); ContentFile.GetContentFile().Save(contentFile); ProjectFile.GetProjectFile().AddContentLayoutFile(contentFile); OrchestrationImage.Instance().StartSavingImages(); OrchestrationImage.Instance().CancelToken.Cancel(); //save token file and add to the project TokenFile.GetTokenFile().Save(tokenFile); ProjectFile.GetProjectFile().AddTokenFile(tokenFile); //save the project file ProjectFile.GetProjectFile().Save(projectFile); TimerStop(); }
/// <summary> /// Save a topic to the file system. /// </summary> /// <remarks>This method must be implemented in all inherited classes.</remarks> private void SaveTopic() { //var bce = CatalogExplorerFactory.CatalogExplorer(); try { //bce.ConnectionString = CatalogExplorerFactory.CatalogExplorer().ConnectionString; var orch = CatalogExplorerFactory.CatalogExplorer().Applications[appName].Orchestrations[orchName]; TokenFile.GetTokenFile().AddTopicToken(CleanAndPrep(appName + ".Orchestrations." + orchName), id); var root = CreateDeveloperConceptualElement(); root.Add(new XElement(xmlns + "introduction", new XElement(xmlns + "para", new XText(!string.IsNullOrEmpty(orch.Description) ? orch.Description : "No description was available from the orchestration.")))); var orchSection = new XElement(xmlns + "section"); #region content var content = new XElement(xmlns + "content"); var imageToken = CleanAndPrep(appName + ".Orchestrations." + orchName + "Image"); content.Add(new XElement(xmlns + "token", imageToken), new XElement(xmlns + "table", new XElement(xmlns + "title", new XText("Orchestration Properties")), new XElement(xmlns + "tableHeader", new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Property")), new XElement(xmlns + "entry", new XText("Value")))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Application")), new XElement(xmlns + "entry", new XElement( xmlns + "token", new XText( appName)))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Assembly Qualified Name")), new XElement(xmlns + "entry", new XElement( xmlns + "token", new XText( CleanAndPrep (orch.AssemblyQualifiedName))))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Auto Resume Suspended Instances")), new XElement(xmlns + "entry", new XText( orch. AutoResumeSuspendedInstances .ToString()))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Auto Suspend Running Instances")), new XElement(xmlns + "entry", new XText( orch. AutoSuspendRunningInstances .ToString()))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Auto Terminate Instances (when unenlisting)")), new XElement(xmlns + "entry", new XText( orch. AutoTerminateInstances .ToString()))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Full Name")), new XElement(xmlns + "entry", new XText( orch.FullName))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText("Host")), GetNullable(orch.Host, "Name", appName + ".Host.")), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Tracking")), new XElement(xmlns + "entry", new XText( orch.Tracking. ToString()))))); orchSection.Add(content); #endregion root.Add(orchSection); #region port section var portSections = new List <XElement>(); var opsList = new XElement(xmlns + "list", new XAttribute("class", "bullet")); foreach (OrchestrationPort port in orch.Ports) { if (port.Orchestration.FullName != orchName) { continue; } foreach (PortTypeOperation operation in port.PortType.Operations) { opsList.Add(new XElement(xmlns + "listItem", new XText(string.Format("{0} ({1})", operation.Name, operation.Type)))); } var ps = new XElement(xmlns + "section", new XElement(xmlns + "title", new XText(port.Name)), new XElement(xmlns + "content", new XElement(xmlns + "para", new XText( "This port contains the following properties:")), new XElement(xmlns + "table", new XElement(xmlns + "title", new XText("Port Properties")), new XElement(xmlns + "tableHeader", new XElement(xmlns + "row", new XElement( xmlns + "entry", new XText ("Property")), new XElement( xmlns + "entry", new XText ("Value")))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Binding")), new XElement(xmlns + "entry", new XText( port.Binding. ToString()))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Modifier")), new XElement(xmlns + "entry", new XText( port.Modifier .ToString ()))), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText ("Receive Port")), GetNullable(port.ReceivePort, "Name", appName + ".ReceivePorts.")), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Send Port")), GetNullable(port.SendPort, "Name", appName + ".SendPorts.")), new XElement(xmlns + "row", new XElement(xmlns + "entry", new XText( "Send Port Group")), GetNullable( port.SendPortGroup, "Name", appName + ".SendPortGroups."))), new XElement(xmlns + "para", new XText("This port definition performs the following operations:")), opsList)); portSections.Add(ps); } #endregion root.Add(new XElement(xmlns + "section", new XElement(xmlns + "title", new XText("Orchestration Ports")), new XElement(xmlns + "content", new XElement(xmlns + "sections", portSections.ToArray())))); if (doc.Root != null) { doc.Root.Add(root); } OrchestrationImage.Instance().Orchestrations.Enqueue(new BtsOrch(orch.Application.Name, orch.FullName)); } catch (Exception ex) { PrintLine("{0}: {1}", ex.GetType(), ex.Message); } }