1515// along with SharpMap; if not, write to the Free Software
1616// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717
18- using ActiveUp . Net . Mail ;
18+ using System ;
1919
2020namespace ActiveUp . Net . Mail
2121{
22- #region Address Object
23-
24- /// <summary>
25- /// Represent an Internet Email address with the owner's fullname.
26- /// </summary>
22+ /// <summary>
23+ /// Represent an Internet Email address with the owner's fullname.
24+ /// </summary>
2725#if ! PocketPC
28- [ System . Serializable ]
26+ [ Serializable ]
2927#endif
30- public class Address
31- {
32- string _email , _name ;
33- /// <summary>
34- /// The default constructor. Set all properties to string.Empty.
35- /// </summary>
36- public Address ( )
37- {
38- this . Email = string . Empty ;
39- this . Name = string . Empty ;
40- }
41-
42- /// <summary>
43- /// Creates the Address using the specified Internet email (RFC 2822 addr-spec).
44- /// </summary>
45- /// <param name="email">The email address to use.</param>
46- public Address ( string email )
47- {
48- /*this.Email =
49- this.Name = string.Empty;*/
50- Address addr = Parser . ParseAddress ( email ) ;
51- this . Email = addr . Email ;
52- this . Name = addr . Name ;
53- }
54-
55- /// <summary>
56- /// Creates the Address using the specified Internet email (RFC 2822 addr-spec) and fullname.
57- /// </summary>
58- /// <param name="email">The email address to use.</param>
59- /// <param name="name">The owner's name.</param>
60- public Address ( string email , string name )
61- {
62- this . Email = email ;
63- this . Name = name ;
64- }
65-
66- /// <summary>
67- /// The Internet email address (RFC 2822 addr-spec).
68- /// </summary>
69- public string Email
70- {
71- get
72- {
73- return _email ;
74- }
75- set
76- {
77- _email = value . Trim ( ) ;
78- }
79- }
80-
81- /// <summary>
82- /// The Address owner's fullname.
83- /// </summary>
84- public string Name
85- {
86- get
87- {
88- //#if TRIAL
89- // return ProductHelper.GetTrialString(this._name, TrialStringType.LongText);
90- //#else
91- return _name ;
92- //#endif
93- }
94- set
95- {
96- _name = value . Trim ( ) ;
97- }
98- }
99-
100- /// <summary>
101- /// Gets a string compliant with RFC2822 address specification that represents the Address with the owner's fullname.
102- /// </summary>
103- public string Merged
104- {
105- get
106- {
107- string getString = string . Empty ;
108-
109- if ( this . Name . Length > 0 )
110- {
111- getString += "\" " + this . Name + "\" " ;
112- getString += "<" + this . Email + ">" ;
113- }
114- else
115- {
116- getString += this . Email ;
117- }
118-
119- return getString ;
120- }
121- }
122-
123- /// <summary>
124- /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
125- /// </summary>
126- /// <returns>
127- /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
128- /// </returns>
129- public override string ToString ( )
130- {
131- return this . Merged ;
132- }
133-
134- ///<summary>
135- /// Gets an HTML formatted link to the address (mailto: form).
136- /// </summary>
137- public string Link
138- {
139- get
140- {
141- string getString = string . Empty ;
142-
143- if ( this . Name . Length > 0 )
144- {
145- getString += "<a href=\" mailto:" + this . Email + "\" >" ;
146- getString += this . Name + "</a>" ;
147- }
148- else
149- {
150- getString += "<a href=\" mailto:" + this . Email + "\" >" ;
151- getString += this . Email + "</a>" ;
152- }
153-
154- return getString ;
155- }
156- }
157-
158- }
159- #endregion
28+ public class Address
29+ {
30+ string _email , _name ;
31+ /// <summary>
32+ /// The default constructor. Set all properties to string.Empty.
33+ /// </summary>
34+ public Address ( )
35+ {
36+ Email = string . Empty ;
37+ Name = string . Empty ;
38+ }
39+
40+ /// <summary>
41+ /// Creates the Address using the specified Internet email (RFC 2822 addr-spec).
42+ /// </summary>
43+ /// <param name="email">The email address to use.</param>
44+ public Address ( string email )
45+ {
46+ Address addr = Parser . ParseAddress ( email ) ;
47+ Email = addr . Email ;
48+ Name = addr . Name ;
49+ }
50+
51+ /// <summary>
52+ /// Creates the Address using the specified Internet email (RFC 2822 addr-spec) and fullname.
53+ /// </summary>
54+ /// <param name="email">The email address to use.</param>
55+ /// <param name="name">The owner's name.</param>
56+ public Address ( string email , string name )
57+ {
58+ Email = email ;
59+ Name = name ;
60+ }
61+
62+ /// <summary>
63+ /// The Internet email address (RFC 2822 addr-spec).
64+ /// </summary>
65+ public string Email
66+ {
67+ get { return _email ; }
68+ set { _email = value . Trim ( ) ; }
69+ }
70+
71+ /// <summary>
72+ /// The Address owner's fullname.
73+ /// </summary>
74+ public string Name
75+ {
76+ get { return _name ; }
77+ set { _name = value . Trim ( ) ; }
78+ }
79+
80+ /// <summary>
81+ /// Gets a string compliant with RFC2822 address specification that represents the Address with the owner's fullname.
82+ /// </summary>
83+ public string Merged
84+ {
85+ get
86+ {
87+ string getString = string . Empty ;
88+
89+ if ( Name . Length > 0 )
90+ {
91+ getString += "\" " + Name + "\" " ;
92+ getString += "<" + Email + ">" ;
93+ }
94+ else
95+ {
96+ getString += Email ;
97+ }
98+
99+ return getString ;
100+ }
101+ }
102+
103+ /// <summary>
104+ /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
105+ /// </summary>
106+ /// <returns>
107+ /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
108+ /// </returns>
109+ public override string ToString ( )
110+ {
111+ return Merged ;
112+ }
113+
114+ ///<summary>
115+ /// Gets an HTML formatted link to the address (mailto: form).
116+ /// </summary>
117+ public string Link
118+ {
119+ get
120+ {
121+ string getString = string . Empty ;
122+
123+ if ( Name . Length > 0 )
124+ {
125+ getString += "<a href=\" mailto:" + Email + "\" >" ;
126+ getString += Name + "</a>" ;
127+ }
128+ else
129+ {
130+ getString += "<a href=\" mailto:" + Email + "\" >" ;
131+ getString += Email + "</a>" ;
132+ }
133+
134+ return getString ;
135+ }
136+ }
137+ }
160138}
0 commit comments