프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / BaseModel / Document.cs @ 96a2080c

이력 | 보기 | 이력해설 | 다운로드 (2.85 KB)

1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.IO;
7
using System.Xml.Linq;
8
using System.Windows.Forms;
9

    
10
namespace Converter.BaseModel
11
{
12
    public class Document
13
    {
14
        private string _DWGNAME;
15
        private string _SIZE;
16
        private List<Symbol> _SYMBOLS;
17
        private List<Text> _TEXTINFOS;
18
        private List<Note> _NOTES;
19
        private List<Line> _LINES;
20
        private List<LineNumber> _LINENUMBERS;
21

    
22
        public List<Symbol> SYMBOLS { get => _SYMBOLS; set => _SYMBOLS = value; }
23
        public List<Text> TEXTINFOS { get => _TEXTINFOS; set => _TEXTINFOS = value; }
24
        public List<Note> NOTES { get => _NOTES; set => _NOTES = value; }
25
        public List<Line> LINES { get => _LINES; set => _LINES = value; }
26
        public List<LineNumber> LINENUMBERS { get => _LINENUMBERS; set => _LINENUMBERS = value; }
27
        public string DWGNAME { get => _DWGNAME; set => _DWGNAME = value; }
28
        public string SIZE { get => _SIZE; set => _SIZE = value; }
29

    
30
        public Document(string xmlPath)
31
        {
32
            try
33
            {
34
                XElement xml = XElement.Load(xmlPath);
35
                DWGNAME = xml.Element("DWGNAME").Value;
36
                SIZE = xml.Element("SIZE").Value;
37

    
38
                SetSymbol(xml.Element("SYMBOLS"));
39
                SetLine(xml.Element("LINEINFOS"));
40
                SetLineNumber(xml.Element("LINENOS"));
41
                SetText(xml.Element("TEXTINFOS"));
42
                SetNote(xml.Element("NOTES"));
43
            }
44
            catch (Exception ex)
45
            {
46
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
47
            }
48
        }
49

    
50
        private void SetSymbol(XElement node)
51
        {
52
            foreach (XElement item in node.Elements("SYMBOL"))
53
            {
54
                SYMBOLS.Add(new Symbol()
55
                {
56

    
57
                });
58
            }
59
        }
60

    
61
        private void SetLine(XElement node)
62
        {
63
            foreach (XElement item in node.Elements("LINE"))
64
            {
65
                LINES.Add(new Line()
66
                {
67

    
68
                });
69
            }
70
        }
71

    
72
        private void SetLineNumber(XElement node)
73
        {
74
            foreach (XElement item in node.Elements("LINE_NO"))
75
            {
76
                LINENUMBERS.Add(new LineNumber()
77
                {
78

    
79
                });
80
            }
81
        }
82

    
83
        private void SetText(XElement node)
84
        {
85
            foreach (XElement item in node.Elements("ATTRIBUTE"))
86
            {
87
                TEXTINFOS.Add(new Text()
88
                {
89

    
90
                });
91
            }
92
        }
93

    
94
        private void SetNote(XElement node)
95
        {
96
            foreach (XElement item in node.Elements("ATTRIBUTE"))
97
            {
98
                NOTES.Add(new Note()
99
                {
100

    
101
                });
102
            }
103
        }
104
    }
105
}
클립보드 이미지 추가 (최대 크기: 500 MB)