Version_03_Edi.zip
AvalonDock
AvalonEdit
Documentation
Architecture.aml
Code Completion.aml
Coordinate Systems.aml
Folding.aml
ICSharpCode.AvalonEdit.content
ICSharpCode.AvalonEdit.shfbproj
License.html
Media
NamespaceDependencies.png
RenderingPipeline.png
VisualTree.png
WelcomeScreenshot.png
Sample Application.aml
Syntax Highlighting.aml
Text Rendering.aml
Welcome.aml
GlobalAssemblyInfo.cs
ICSharpCode.AvalonEdit.Tests
ICSharpCode.AvalonEdit
Edi.sln
Edi
App.xaml
App.xaml.cs
Command
Converter
Edi.csproj
Images
App
DocTab
Lock-icon.png
Edit_Copy32.png
Edit_Cut32.png
Edit_Delete32.png
Edit_Find_Replace32.png
Edit_Find16.ico
Edit_Find32.png
Edit_Paste32.png
Edit_Redo32.png
Edit_Undo32.png
File_New32.png
File_Open32.png
File_Save_All32.png
File_Save16.png
File_Save32.png
File_Save64.png
Help_About32.png
Help_Hint32.png
ShowEnter32.png
ShowLineNumbers32.png
ShowSpaces32.png
ShowTab32.png
ShowWordWrap32.png
SyntaxHighlighting_32.png
document.png
property-blue.png
Properties
View
ViewModel
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using ICSharpCode.AvalonEdit.Document;
namespace ICSharpCode.AvalonEdit.Xml
{
/// <summary>
/// Represents any markup starting with "<" and (hopefully) ending with ">"
/// </summary>
public class AXmlTag: AXmlContainer
{
/// <summary> These identify the start of DTD elements </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification="ReadOnlyCollection is immutable")]
public static readonly ReadOnlyCollection<string> DtdNames = new ReadOnlyCollection<string>(
new string[] {"<!DOCTYPE", "<!NOTATION", "<!ELEMENT", "<!ATTLIST", "<!ENTITY" } );
/// <summary> Opening bracket - usually "<" </summary>
public string OpeningBracket { get; internal set; }
/// <summary> Name following the opening bracket </summary>
public string Name { get; internal set; }
/// <summary> Opening bracket - usually ">" </summary>
public string ClosingBracket { get; internal set; }
/// <summary> True if tag starts with "<" </summary>
public bool IsStartOrEmptyTag { get { return OpeningBracket == "<"; } }
/// <summary> True if tag starts with "<" and ends with ">" </summary>
public bool IsStartTag { get { return OpeningBracket == "<" && ClosingBracket == ">"; } }
/// <summary> True if tag starts with "<" and does not end with ">" </summary>
public bool IsEmptyTag { get { return OpeningBracket == "<" && ClosingBracket != ">" ; } }
/// <summary> True if tag starts with "</" </summary>
public bool IsEndTag { get { return OpeningBracket == "</"; } }
/// <summary> True if tag starts with "<?" </summary>
public bool IsProcessingInstruction { get { return OpeningBracket == "<?"; } }
/// <summary> True if tag starts with "<!--" </summary>
public bool IsComment { get { return OpeningBracket == "<!--"; } }
/// <summary> True if tag starts with "<![CDATA[" </summary>
public bool IsCData { get { return OpeningBracket == "<![CDATA["; } }
/// <summary> True if tag starts with one of the DTD starts </summary>
public bool IsDocumentType { get { return DtdNames.Contains(OpeningBracket); } }
/// <summary> True if tag starts with "<!" </summary>
public bool IsUnknownBang { get { return OpeningBracket == "<!"; } }
#region Helpper methods
AXmlAttributeCollection attributes;
/// <summary> Gets attributes of the tag (if applicable) </summary>
public AXmlAttributeCollection Attributes {
get {
if (attributes == null) {
attributes = new AXmlAttributeCollection(this.Children);
}
return attributes;
}
}
#endregion
internal override void DebugCheckConsistency(bool checkParentPointers)
{
Assert(OpeningBracket != null, "Null OpeningBracket");
Assert(Name != null, "Null Name");
Assert(ClosingBracket != null, "Null ClosingBracket");
base.DebugCheckConsistency(checkParentPointers);
}
/// <inheritdoc/>
public override void AcceptVisitor(IAXmlVisitor visitor)
{
visitor.VisitTag(this);
}
/// <inheritdoc/>
internal override bool UpdateDataFrom(AXmlObject source)
{
if (!base.UpdateDataFrom(source)) return false;
AXmlTag src = (AXmlTag)source;
if (this.OpeningBracket != src.OpeningBracket ||
this.Name != src.Name ||
this.ClosingBracket != src.ClosingBracket)
{
OnChanging();
this.OpeningBracket = src.OpeningBracket;
this.Name = src.Name;
this.ClosingBracket = src.ClosingBracket;
OnChanged();
return true;
} else {
return false;
}
}
/// <inheritdoc/>
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "[{0} '{1}{2}{3}' Attr:{4}]", base.ToString(), this.OpeningBracket, this.Name, this.ClosingBracket, this.Children.Count);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
The Windows Presentation Foundation (WPF) and C# are among my favorites and so I developed
Edi
and a few other projects on
GitHub. I am normally an algorithms and structure type but WPF has such interesting UI sides that I cannot help myself but get into it.
https://de.linkedin.com/in/dirkbahle