1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 | using System.Xml.Serialization;
|
---|
4 | using System.IO;
|
---|
5 |
|
---|
6 | namespace Netron.GraphLib.IO.NML {
|
---|
7 |
|
---|
8 | /// <summary>
|
---|
9 | /// Generic XML wrapper for any diagram data
|
---|
10 | /// </summary>
|
---|
11 | [XmlType(IncludeInSchema=true, TypeName="GraphInformation.type")]
|
---|
12 | [XmlRoot(ElementName="GraphInformation", IsNullable=false, DataType="")]
|
---|
13 | public class GraphInformationType {
|
---|
14 |
|
---|
15 | #region Fields
|
---|
16 | /// <summary>
|
---|
17 | /// the description of the graph
|
---|
18 | /// </summary>
|
---|
19 | private string mDescription = string.Empty;
|
---|
20 | /// <summary>
|
---|
21 | /// the author of the graph
|
---|
22 | /// </summary>
|
---|
23 | private string mAuthor = string.Empty;
|
---|
24 | /// <summary>
|
---|
25 | /// the creation date of the graph
|
---|
26 | /// </summary>
|
---|
27 | private string mCreationDate = string.Empty;
|
---|
28 | /// <summary>
|
---|
29 | /// the subject of the graph
|
---|
30 | /// </summary>
|
---|
31 | private string mSubject = string.Empty;
|
---|
32 | /// <summary>
|
---|
33 | /// the title of the graph
|
---|
34 | /// </summary>
|
---|
35 | private string mTitle = string.Empty;
|
---|
36 |
|
---|
37 | #endregion
|
---|
38 |
|
---|
39 | #region Properties
|
---|
40 | /// <summary>
|
---|
41 | /// Gets or sets the description of the graph
|
---|
42 | /// </summary>
|
---|
43 | [XmlElement("Description",typeof(string))]
|
---|
44 | public string Description
|
---|
45 | {
|
---|
46 | get{return mDescription;}
|
---|
47 | set{mDescription = value;}
|
---|
48 | }
|
---|
49 |
|
---|
50 | /// <summary>
|
---|
51 | /// Gets or sets the author of the graph
|
---|
52 | /// </summary>
|
---|
53 | [XmlElement("Author",typeof(string))]
|
---|
54 | public string Author
|
---|
55 | {
|
---|
56 | get{return mAuthor;}
|
---|
57 | set{mAuthor = value;}
|
---|
58 | }
|
---|
59 | /// <summary>
|
---|
60 | /// Gets or sets the creation date of the graph
|
---|
61 | /// </summary>
|
---|
62 | [XmlElement("CreationDate",typeof(string))]
|
---|
63 | public string CreationDate
|
---|
64 | {
|
---|
65 | get{return mCreationDate;}
|
---|
66 | set{mCreationDate = value;}
|
---|
67 | }
|
---|
68 | /// <summary>
|
---|
69 | /// Gets or sets the subject of the graph
|
---|
70 | /// </summary>
|
---|
71 | [XmlElement("Subject",typeof(string))]
|
---|
72 | public string Subject
|
---|
73 | {
|
---|
74 | get{return mSubject;}
|
---|
75 | set{mSubject = value;}
|
---|
76 | }
|
---|
77 | /// <summary>
|
---|
78 | /// Gets or sets the title of the graph
|
---|
79 | /// </summary>
|
---|
80 | [XmlElement("Title",typeof(string))]
|
---|
81 | public string Title
|
---|
82 | {
|
---|
83 | get{return mTitle;}
|
---|
84 | set{mTitle = value;}
|
---|
85 | }
|
---|
86 | #endregion
|
---|
87 |
|
---|
88 | #region Constructor
|
---|
89 | /// <summary>
|
---|
90 | /// Required XMLSerilization constructor
|
---|
91 | /// </summary>
|
---|
92 | public GraphInformationType(){}
|
---|
93 | /// <summary>
|
---|
94 | /// Default constructor
|
---|
95 | /// </summary>
|
---|
96 | /// <param name="info"></param>
|
---|
97 | public GraphInformationType(GraphInformation info)
|
---|
98 | {
|
---|
99 | this.mAuthor = info.Author;
|
---|
100 | this.mCreationDate = info.CreationDate;
|
---|
101 | this.mDescription = info.Description;
|
---|
102 | this.mSubject = info.Subject;
|
---|
103 | this.mTitle = info.Title;
|
---|
104 | }
|
---|
105 |
|
---|
106 |
|
---|
107 | #endregion
|
---|
108 |
|
---|
109 |
|
---|
110 | /// <summary>
|
---|
111 | /// Returns this type as a GraphInformation object.
|
---|
112 | /// </summary>
|
---|
113 | /// <remarks>Used at deserialization</remarks>
|
---|
114 | /// <returns></returns>
|
---|
115 | public GraphInformation ToGraphInformation()
|
---|
116 | {
|
---|
117 | GraphInformation gi = new GraphInformation();
|
---|
118 | gi.Author = this.Author;
|
---|
119 | gi.CreationDate = this.mCreationDate;
|
---|
120 | gi.Description =this.mDescription;
|
---|
121 | gi.Subject = this.mSubject;
|
---|
122 | gi.Title = this.mTitle;
|
---|
123 | return gi;
|
---|
124 | }
|
---|
125 |
|
---|
126 | }
|
---|
127 | }
|
---|