Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Framework / Configuration / SmtpConfig.cs
blob56692e7c920df6381567ebbeb6b0ec663450e2f1
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework.Configuration
17 using System;
18 using System.Xml;
20 /// <summary>
21 /// Represents the SMTP configuration
22 /// on the configuration file
23 /// </summary>
24 public class SmtpConfig : ISerializedConfig
26 private String host = "localhost";
27 private int port = 25;
28 private String username;
29 private String password;
31 /// <summary>
32 /// Deserializes the specified smtp section.
33 /// </summary>
34 /// <param name="section">The smtp section.</param>
35 public void Deserialize(XmlNode section)
37 XmlAttribute smtpHostAtt = section.Attributes["smtpHost"];
38 XmlAttribute smtpPortAtt = section.Attributes["smtpPort"];
39 XmlAttribute smtpUserAtt = section.Attributes["smtpUsername"];
40 XmlAttribute smtpPwdAtt = section.Attributes["smtpPassword"];
42 if (smtpHostAtt != null && smtpHostAtt.Value != String.Empty)
44 host = smtpHostAtt.Value;
46 if (smtpPortAtt != null && smtpPortAtt.Value != String.Empty)
48 port = int.Parse(smtpPortAtt.Value);
50 if (smtpUserAtt != null && smtpUserAtt.Value != String.Empty)
52 username = smtpUserAtt.Value;
54 if (smtpPwdAtt != null && smtpPwdAtt.Value != String.Empty)
56 password = smtpPwdAtt.Value;
60 /// <summary>
61 /// Gets or sets the smtp host.
62 /// </summary>
63 /// <value>The host.</value>
64 public String Host
66 get { return host; }
67 set { host = value; }
70 /// <summary>
71 /// Gets or sets the smtp port.
72 /// </summary>
73 /// <value>The port.</value>
74 public int Port
76 get { return port; }
77 set { port = value; }
80 /// <summary>
81 /// Gets or sets the smtp username.
82 /// </summary>
83 /// <value>The username.</value>
84 public String Username
86 get { return username; }
87 set { username = value; }
90 /// <summary>
91 /// Gets or sets the smtp password.
92 /// </summary>
93 /// <value>The password.</value>
94 public String Password
96 get { return password; }
97 set { password = value; }