本文整理汇总了C#中GeneralTree.AcceptVisitor方法的典型用法代码示例。如果您正苦于以下问题:C# GeneralTree.AcceptVisitor方法的具体用法?C# GeneralTree.AcceptVisitor怎么用?C# GeneralTree.AcceptVisitor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeneralTree
的用法示例。
在下文中一共展示了GeneralTree.AcceptVisitor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
public void Build(GeneralTree<INode> features)
{
if (log.IsInfoEnabled)
{
log.Info("Writing HTML to {0}", this.configuration.OutputFolder.FullName);
}
this.htmlResourceWriter.WriteTo(this.configuration.OutputFolder.FullName);
var actionVisitor = new ActionVisitor<INode>(node => this.VisitNodes(features, node));
if (features != null)
features.AcceptVisitor(actionVisitor);
}
示例2: Build
public void Build(GeneralTree<IDirectoryTreeNode> features)
{
this.ditaMapBuilder.Build(features);
var actionVisitor = new ActionVisitor<IDirectoryTreeNode>(node =>
{
var featureDirectoryTreeNode =
node as FeatureDirectoryTreeNode;
if (featureDirectoryTreeNode != null)
{
this.ditaFeatureFormatter.Format(
featureDirectoryTreeNode);
}
});
features.AcceptVisitor(actionVisitor);
}
示例3: ApplyTestResultsToFeatures
private static void ApplyTestResultsToFeatures(IContainer container, Configuration configuration, GeneralTree<INode> features)
{
var testResults = container.Resolve<ITestResults>();
var actionVisitor = new ActionVisitor<INode>(node =>
{
var featureTreeNode = node as FeatureNode;
if (featureTreeNode == null) return;
if (configuration.HasTestResults)
{
SetResultsAtFeatureLevel(featureTreeNode, testResults);
SetResultsForIndividualScenariosUnderFeature(featureTreeNode, testResults);
}
else
{
featureTreeNode.Feature.Result = TestResult.Inconclusive();
}
});
features.AcceptVisitor(actionVisitor);
}
示例4: Build
public void Build(GeneralTree<IDirectoryTreeNode> features)
{
if (log.IsInfoEnabled)
{
log.InfoFormat("Writing HTML to {0}", this.configuration.OutputFolder.FullName);
}
this.htmlResourceWriter.WriteTo(this.configuration.OutputFolder.FullName);
var actionVisitor = new ActionVisitor<IDirectoryTreeNode>(node =>
{
if (node.IsIndexMarkDownNode())
{
return;
}
var nodePath = Path.Combine(this.configuration.OutputFolder.FullName, node.RelativePathFromRoot);
string htmlFilePath;
if (node.IsContent)
{
htmlFilePath = nodePath.Replace(Path.GetExtension(nodePath), ".html");
}
else
{
Directory.CreateDirectory(nodePath);
htmlFilePath = Path.Combine(nodePath, "index.html");
}
using (var writer = new StreamWriter(htmlFilePath, false, Encoding.UTF8))
{
var document = this.htmlDocumentFormatter.Format(node, features, this.configuration.FeatureFolder);
document.Save(writer);
writer.Close();
}
});
features.AcceptVisitor(actionVisitor);
}
示例5: Build
public void Build(GeneralTree<IDirectoryTreeNode> features)
{
if (log.IsInfoEnabled)
{
log.InfoFormat("Writing Excel workbook to {0}", this.configuration.OutputFolder.FullName);
}
string spreadsheetPath = Path.Combine(this.configuration.OutputFolder.FullName, "features.xlsx");
using (var workbook = new XLWorkbook())
{
var actionVisitor = new ActionVisitor<IDirectoryTreeNode>(node =>
{
var featureDirectoryTreeNode =
node as FeatureDirectoryTreeNode;
if (featureDirectoryTreeNode != null)
{
IXLWorksheet worksheet =
workbook.AddWorksheet(
this.excelSheetNameGenerator.
GenerateSheetName(
workbook,
featureDirectoryTreeNode
.Feature));
this.excelFeatureFormatter.Format(
worksheet,
featureDirectoryTreeNode.
Feature);
}
});
features.AcceptVisitor(actionVisitor);
this.excelTableOfContentsFormatter.Format(workbook, features);
workbook.SaveAs(spreadsheetPath);
}
}
示例6: Build
public void Build(GeneralTree<INode> features)
{
string filename = string.IsNullOrEmpty(this.configuration.SystemUnderTestName)
? "features.docx"
: this.configuration.SystemUnderTestName + ".docx";
string documentFileName = this.fileSystem.Path.Combine(this.configuration.OutputFolder.FullName, filename);
if (this.fileSystem.File.Exists(documentFileName))
{
try
{
this.fileSystem.File.Delete(documentFileName);
}
catch (System.IO.IOException ex)
{
Log.Error("Cannot delete Word file. Is it still open in Word?", ex);
return;
}
}
using (
WordprocessingDocument wordProcessingDocument = WordprocessingDocument.Create(
documentFileName,
WordprocessingDocumentType.Document))
{
MainDocumentPart mainDocumentPart = wordProcessingDocument.AddMainDocumentPart();
this.wordStyleApplicator.AddStylesPartToPackage(wordProcessingDocument);
this.wordStyleApplicator.AddStylesWithEffectsPartToPackage(wordProcessingDocument);
this.wordFontApplicator.AddFontTablePartToPackage(wordProcessingDocument);
var documentSettingsPart = mainDocumentPart.AddNewPart<DocumentSettingsPart>();
documentSettingsPart.Settings = new Settings();
this.wordHeaderFooterFormatter.ApplyHeaderAndFooter(wordProcessingDocument);
var document = new Document();
var body = new Body();
document.Append(body);
var actionVisitor = new ActionVisitor<INode>(node =>
{
var featureDirectoryTreeNode =
node as FeatureNode;
if (featureDirectoryTreeNode != null)
{
this.wordFeatureFormatter.Format(body, featureDirectoryTreeNode);
}
});
features.AcceptVisitor(actionVisitor);
mainDocumentPart.Document = document;
mainDocumentPart.Document.Save();
}
// HACK - Add the table of contents
using (WordprocessingDocument wordProcessingDocument = WordprocessingDocument.Open(documentFileName, true))
{
XElement firstPara = wordProcessingDocument
.MainDocumentPart
.GetXDocument()
.Descendants(W.p)
.FirstOrDefault();
TocAdder.AddToc(wordProcessingDocument, firstPara, @"TOC \o '1-2' \h \z \u", null, 4);
}
}
示例7: Build
public void Build(GeneralTree<INode> features)
{
if (log.IsInfoEnabled)
{
log.Info("Writing JSON to {0}", this.configuration.OutputFolder.FullName);
}
var featuresToFormat = new List<FeatureWithMetaInfo>();
var actionVisitor = new ActionVisitor<INode>(node =>
{
var featureTreeNode =
node as FeatureNode;
if (featureTreeNode != null)
{
if (this.configuration.HasTestResults)
{
featuresToFormat.Add(
new FeatureWithMetaInfo(
featureTreeNode,
this.testResults.
GetFeatureResult(
featureTreeNode.
Feature)));
}
else
{
featuresToFormat.Add(
new FeatureWithMetaInfo(
featureTreeNode));
}
}
});
features.AcceptVisitor(actionVisitor);
CreateFile(this.OutputFilePath, GenerateJSON(featuresToFormat));
}