-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathGraphInformation.cs
More file actions
159 lines (141 loc) · 3.77 KB
/
GraphInformation.cs
File metadata and controls
159 lines (141 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using System;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
using System.Diagnostics;
namespace Netron.GraphLib
{
/// <summary>
/// Allows to add meta-info to the graph; author, description, date and so on
/// </summary>
[Serializable] public class GraphInformation : ISerializable
{
#region Fields
/// <summary>
/// the description of the graph
/// </summary>
private string mDescription = string.Empty;
/// <summary>
/// the author of the graph
/// </summary>
private string mAuthor = string.Empty;
/// <summary>
/// the creation date of the graph
/// </summary>
private string mCreationDate = string.Empty;
/// <summary>
/// the subject of the graph
/// </summary>
private string mSubject = string.Empty;
/// <summary>
/// the title of the graph
/// </summary>
private string mTitle = string.Empty;
#endregion
#region Properties
/// <summary>
/// Gets or sets the description of the graph
/// </summary>
public string Description
{
get{return mDescription;}
set{mDescription = value;}
}
/// <summary>
/// Gets or sets the author of the graph
/// </summary>
public string Author
{
get{return mAuthor;}
set{mAuthor = value;}
}
/// <summary>
/// Gets or sets the creation date of the graph
/// </summary>
public string CreationDate
{
get{return mCreationDate;}
set{mCreationDate = value;}
}
/// <summary>
/// Gets or sets the subject of the graph
/// </summary>
public string Subject
{
get{return mSubject;}
set{mSubject = value;}
}
/// <summary>
/// Gets or sets the title of the graph
/// </summary>
public string Title
{
get{return mTitle;}
set{mTitle = value;}
}
#endregion
#region Constructors
/// <summary>
/// Default ctor
/// </summary>
public GraphInformation()
{
mCreationDate = DateTime.Now.ToUniversalTime().ToString();
}
/// <summary>
/// Constructs an ew instance with the given title
/// </summary>
/// <param name="title"></param>
public GraphInformation(string title):this()
{
mTitle = title;
}
/// <summary>
/// Constructs a new instance with the given title and author
/// </summary>
/// <param name="title"></param>
/// <param name="author"></param>
public GraphInformation(string title, string author):this(title)
{
mAuthor = author;
}
/// <summary>
/// Constructs a new instance with the given title, subject and author
/// </summary>
/// <param name="title"></param>
/// <param name="author"></param>
/// <param name="subject"></param>
public GraphInformation(string title, string author, string subject):this(title, author)
{
mSubject = subject;
}
/// <summary>
/// Deserialization constructor
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
public GraphInformation(SerializationInfo info, StreamingContext context)
{
this.mAuthor = info.GetString("mAuthor");
this.mCreationDate = info.GetString("mCreationDate");
this.mDescription = info.GetString("mDescription");
this.mSubject = info.GetString("mSubject");
this.mTitle = info.GetString("mTitle");
}
#endregion
/// <summary>
/// ISerializable implementation
/// </summary>
/// <param name="info">the serialization info</param>
/// <param name="context">the streaming context</param>
[SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("mAuthor",this.mAuthor);
info.AddValue("mCreationDate",this.mCreationDate);
info.AddValue("mDescription",this.mDescription);
info.AddValue("mTitle",this.mTitle);
info.AddValue("mSubject",this.mSubject);
}
}
}