コード例 #1
0
        private void ApplyOptions(IList <string> ignoredNamespacesPrefixes, bool ignoreDesignTimeReferencePrefix)
        {
            var indentService            = new IndentService(options);
            var markupExtensionFormatter = new MarkupExtensionFormatter(options.NoNewLineMarkupExtensions.ToList());
            var attributeInfoFactory     = new AttributeInfoFactory(new MarkupExtensionParser(), new AttributeOrderRules(options), ignoredNamespacesPrefixes, ignoreDesignTimeReferencePrefix);
            var attributeInfoFormatter   = new AttributeInfoFormatter(markupExtensionFormatter, indentService);

            this.documentProcessors = new Dictionary <XmlNodeType, IDocumentProcessor>
            {
                // { XmlNodeType.None, null },
                { XmlNodeType.Element, new ElementDocumentProcessor(options, xamlLanguageOptions, attributeInfoFactory, attributeInfoFormatter, indentService, xmlEscapingService) },
                // { XmlNodeType.Attribute, null },
                { XmlNodeType.Text, new TextDocumentProcessor(indentService) },
                { XmlNodeType.CDATA, new CDATADocumentProcessor(indentService) },
                // { XmlNodeType.EntityReference, null },
                // { XmlNodeType.Entity, null },
                { XmlNodeType.ProcessingInstruction, new ProcessInstructionDocumentProcessor(indentService) },
                { XmlNodeType.Comment, new CommentDocumentProcessor(options, indentService) },
                // { XmlNodeType.Document, null },
                // { XmlNodeType.DocumentType, null },
                // { XmlNodeType.DocumentFragment, null },
                // { XmlNodeType.Notation, null },
                { XmlNodeType.Whitespace, new WhitespaceDocumentProcessor() },
                { XmlNodeType.SignificantWhitespace, new SignificantWhitespaceDocumentProcessor() },
                { XmlNodeType.EndElement, new EndElementDocumentProcessor(options, indentService) },
                // { XmlNodeType.EndEntity, null },
                // ignoring xml declarations for Xamarin support
                { XmlNodeType.XmlDeclaration, new XmlDeclarationDocumentProcessor() }
            };
        }
コード例 #2
0
        public void TestNormalize(string sourceText, string expected)
        {
            var indentService = new IndentService(true, 4);
            var result        = indentService.Normalize(sourceText);

            Assert.That(result, Is.EqualTo(expected));
        }
コード例 #3
0
        public StylerService(IStylerOptions options)
        {
            this.xmlEscapingService          = new XmlEscapingService();
            this.documentManipulationService = new DocumentManipulationService(options);

            var indentService            = new IndentService(options);
            var markupExtensionFormatter = new MarkupExtensionFormatter(options.NoNewLineMarkupExtensions.ToList());
            var attributeInfoFactory     = new AttributeInfoFactory(new MarkupExtensionParser(), new AttributeOrderRules(options));
            var attributeInfoFormatter   = new AttributeInfoFormatter(markupExtensionFormatter, indentService);

            this.documentProcessors = new Dictionary <XmlNodeType, IDocumentProcessor>
            {
                // { XmlNodeType.None, null },
                { XmlNodeType.Element, new ElementDocumentProcessor(options, attributeInfoFactory, attributeInfoFormatter, indentService) },
                // { XmlNodeType.Attribute, null },
                { XmlNodeType.Text, new TextDocumentProcessor(indentService) },
                { XmlNodeType.CDATA, new CDATADocumentProcessor(indentService) },
                // { XmlNodeType.EntityReference, null },
                // { XmlNodeType.Entity, null },
                { XmlNodeType.ProcessingInstruction, new ProcessInstructionDocumentProcessor(indentService) },
                { XmlNodeType.Comment, new CommentDocumentProcessor(options, indentService) },
                // { XmlNodeType.Document, null },
                // { XmlNodeType.DocumentType, null },
                // { XmlNodeType.DocumentFragment, null },
                // { XmlNodeType.Notation, null },
                { XmlNodeType.Whitespace, new WhitespaceDocumentProcessor() },
                { XmlNodeType.SignificantWhitespace, new SignificantWhitespaceDocumentProcessor() },
                { XmlNodeType.EndElement, new EndElementDocumentProcessor(options, indentService) },
                // { XmlNodeType.EndEntity, null },
                // ignoring xml declarations for Xamarin support
                { XmlNodeType.XmlDeclaration, new XmlDeclarationDocumentProcessor() }
            };
        }
コード例 #4
0
 public ElementDocumentProcessor(IStylerOptions options, AttributeInfoFactory attributeInfoFactory, AttributeInfoFormatter attributeInfoFormatter, IndentService indentService)
 {
     _options = options;
     _attributeInfoFactory   = attributeInfoFactory;
     _attributeInfoFormatter = attributeInfoFormatter;
     _indentService          = indentService;
     _noNewLineElementsList  = options.NoNewLineElements.ToList();
 }
コード例 #5
0
 public ElementDocumentProcessor(
     IStylerOptions options,
     AttributeInfoFactory attributeInfoFactory,
     AttributeInfoFormatter attributeInfoFormatter,
     IndentService indentService)
 {
     this.options = options;
     this.attributeInfoFactory   = attributeInfoFactory;
     this.attributeInfoFormatter = attributeInfoFormatter;
     this.indentService          = indentService;
     this.noNewLineElementsList  = options.NoNewLineElements.ToList();
     this.firstLineAttributes    = options.FirstLineAttributes.ToList();
 }
コード例 #6
0
        public void TestNormalize(string sourceText, string expected)
        {
            var indentService = new IndentService(new StylerOptions()
            {
                IndentWithTabs            = true,
                IndentSize                = 4,
                AttributeIndentationStyle = AttributeIndentationStyle.Mixed
            });

            var result = indentService.Normalize(sourceText);

            Assert.That(result, Is.EqualTo(expected));
        }
コード例 #7
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (Input_IndentNo.Text == "" || Input_Date.SelectedDate == null || listMaterial.Where(x => x.Quantity != 0).ToList().Count == 0)
            {
                MessageBox.Show("Please Enter Indent No ,  Date and Quantity");
                return;
            }

            var Indent = new Indent();

            Indent.IndentNo = Input_IndentNo.Text;
            Indent.Date     = Input_Date.SelectedDate;
            IndentService.addIndent(Indent, listMaterial.Where(x => x.Quantity > 0).ToList());

            MessageBox.Show("Indent Added Successfuly");
            Input_IndentNo.Text     = "";
            Input_Date.SelectedDate = null;
        }
コード例 #8
0
 public AttributeInfoFormatter(MarkupExtensionFormatter formatter, IndentService indentService)
 {
     this.formatter     = formatter;
     this.indentService = indentService;
 }
コード例 #9
0
 public CommentDocumentProcessor(IStylerOptions options, IndentService indentService)
 {
     this.options       = options;
     this.indentService = indentService;
 }
コード例 #10
0
 public TextDocumentProcessor(IndentService indentService)
 {
     this.indentService = indentService;
 }
コード例 #11
0
 public CDATADocumentProcessor(IndentService indentService)
 {
     _indentService = indentService;
 }
コード例 #12
0
 public ProcessInstructionDocumentProcessor(IndentService indentService)
 {
     this.indentService = indentService;
 }
コード例 #13
0
 public EndElementDocumentProcessor(IStylerOptions options, IndentService indentService)
 {
     _indentService = indentService;
     _options       = options;
 }