Example #1
0
 public XmlData(string name, XmlData parent = null)
     : this()
 {
     Name = name;
     if (parent != null)
         parent.AddChild(this);
 }
Example #2
0
 private static XmlData CreateVectorTextData()
 {
     var vectorTextData = new XmlData("VectorText");
     var character = new XmlData("Char1", vectorTextData);
     character.AddAttribute("Character", "A");
     character.AddAttribute("Lines", "(0,0)-(1,1)");
     return vectorTextData;
 }
Example #3
0
        public XmlFile(string filePath)
        {
            XDocument xDoc;
            using (
                var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                xDoc = XDocument.Load(stream);

            Root = new XmlData(xDoc.Root);
        }
        private void SetupVectorText()
        {
            vectorTextData = new XmlData("VectorText");
            for (int i = 'A'; i <= 'Z'; i++)
                AddCharacter(i);

            for (int i = '0'; i <= '9'; i++)
                AddCharacter(i);

            AddCharacter('.');
            testResolver.RegisterMock(vectorTextData);
        }
Example #5
0
        internal XmlData(XElement root, XmlData parent = null)
            : this()
        {
            Parent = parent;
            Name = root.Name.LocalName;
            string text = string.Concat(root.Nodes().OfType<XText>().Select(t => t.Value));
            if (!string.IsNullOrEmpty(text))
                Value = text;

            InitializeAttributes(root);
            InitializeChildren(root);
            if (parent != null)
                parent.Children.Add(this);
        }
Example #6
0
        public bool RemoveChild(XmlData child)
        {
            if (!Children.Contains(child))
                return false;

            Children.Remove(child);
            return true;
        }
Example #7
0
 public void AddChild(XmlData child)
 {
     child.Parent = this;
     Children.Add(child);
 }
Example #8
0
 public XmlFile(XmlData xmlData)
 {
     Root = xmlData;
 }
 private void AddCharacter(int i)
 {
     var character = new XmlData("Char" + i, vectorTextData);
     character.AddAttribute("Character", (char)i);
     character.AddAttribute("Lines", "(0,0)-(1,1)");
 }
Example #10
0
 public VectorText(XmlData vectorTextData, Point topLeft, float height)
 {
     charData = vectorTextData.Children;
     TopLeft = topLeft;
     Height = height;
 }
Example #11
0
 public XmlSnippet(string xmlAsText)
 {
     xmlAsText = RemoveLeadingJunk(xmlAsText);
     XDocument xDocument = XDocument.Parse(xmlAsText);
     Root = new XmlData(xDocument.Root);
 }
Example #12
0
 public XmlMemoryStream(Stream stream)
 {
     stream.Seek(0, SeekOrigin.Begin);
     XDocument xDoc = XDocument.Load(stream);
     Root = new XmlData(xDoc.Root);
 }
Example #13
0
 public XmlMemoryStream(XmlData xmlData)
 {
     Root = xmlData;
 }