protected void LoadWebmailSettings() { try { string filename = Path.Combine(Utils.GetDataFolderPath(), @"Settings\settings.xml"); using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) { XPathDocument xpathDoc = new XPathDocument(fs); XPathNavigator xpathNav = xpathDoc.CreateNavigator(); XPathNodeIterator xpathIter = xpathNav.Select("Settings/WindowTitle"); if (xpathIter.MoveNext()) { this.WindowTitle = xpathIter.Current.Value; } this.LicenseKey = "MNWL"; xpathIter = xpathNav.Select("Settings/AdminPassword"); if (xpathIter.MoveNext()) { this.AdminPassword = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/IncomingMailProtocol"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.IncomingMailProtocol = (IncomingMailProtocol)int.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/IncomingMailServer"); if (xpathIter.MoveNext()) { this.IncomingMailServer = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/IncomingMailPort"); if (xpathIter.MoveNext()) { this.IncomingMailPort = int.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/OutgoingMailServer"); if (xpathIter.MoveNext()) { this.OutgoingMailServer = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/OutgoingMailPort"); if (xpathIter.MoveNext()) { this.OutgoingMailPort = int.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/ReqSmtpAuth"); if (xpathIter.MoveNext()) { this.ReqSmtpAuth = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/AllowAdvancedLogin"); if (xpathIter.MoveNext()) { this.AllowAdvancedLogin = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/HideLoginMode"); if (xpathIter.MoveNext()) { this.HideLoginMode = (LoginMode)short.Parse(xpathIter.Current.Value, CultureInfo.InvariantCulture); } xpathIter = xpathNav.Select("Settings/DefaultDomainOptional"); if (xpathIter.MoveNext()) { this.DefaultDomainOptional = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/ShowTextLabels"); if (xpathIter.MoveNext()) { this.ShowTextLabels = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/AutomaticCorrectLoginSettings"); if (xpathIter.MoveNext()) { this.AutomaticCorrectLoginSettings = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/EnableLogging"); if (xpathIter.MoveNext()) { this.EnableLogging = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/AllowAjax"); if (xpathIter.MoveNext()) { this.AllowAjax = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/MailsPerPage"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.MailsPerPage = short.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/AttachmentSizeLimit"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.AttachmentSizeLimit = long.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/EnableAttachmentSizeLimit"); if (xpathIter.MoveNext()) { this.EnableAttachmentSizeLimit = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/MailboxSizeLimit"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.MailboxSizeLimit = long.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/EnableMailboxSizeLimit"); if (xpathIter.MoveNext()) { this.EnableMailboxSizeLimit = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0) ? true : false; } xpathIter = xpathNav.Select("Settings/DefaultTimeZone"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.DefaultTimeZone = short.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/DefaultUserCharset"); if (xpathIter.MoveNext()) { if (xpathIter.Current.Value != string.Empty) this.DefaultUserCharset = int.Parse(xpathIter.Current.Value); } xpathIter = xpathNav.Select("Settings/DefaultSkin"); if (xpathIter.MoveNext()) { this.DefaultSkin = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/DefaultLanguage"); if (xpathIter.MoveNext()) { this.DefaultLanguage = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/ViewMode"); if (xpathIter.MoveNext()) { this.Mode = (ViewMode)int.Parse(xpathIter.Current.Value, CultureInfo.InvariantCulture); } xpathIter = xpathNav.Select("Settings/EnableWmServer"); if (xpathIter.MoveNext()) { this.EnableWmServer = (string.Compare(xpathIter.Current.Value, "1", true, CultureInfo.InvariantCulture) == 0); } xpathIter = xpathNav.Select("Settings/WmServerRootPath"); if (xpathIter.MoveNext()) { this.WmServerRootPath = xpathIter.Current.Value; } xpathIter = xpathNav.Select("Settings/WmServerHost"); if (xpathIter.MoveNext()) { this.WmServerHost = xpathIter.Current.Value; } if (this.EnableWmServer) { //read webmail.tab _webmailTab = Utils.ReadWebmailTab(this.WmServerRootPath); } } } catch (Exception ex) { throw new WebMailSettingsException(ex); } }
<?xml version="1.0" encoding="utf-8" ?> - <Settings> <WindowTitle>MailBee WebMail Lite</WindowTitle> <AdminPassword>12345</AdminPassword> <IncomingMailServer>pop.fund500.com</IncomingMailServer> <IncomingMailPort>110</IncomingMailPort> <OutgoingMailServer>smtp.fund500.com</OutgoingMailServer> <OutgoingMailPort>25</OutgoingMailPort> <ReqSmtpAuth>1</ReqSmtpAuth> <AllowAdvancedLogin>1</AllowAdvancedLogin> <HideLoginMode>0</HideLoginMode> <DefaultDomainOptional>localhost</DefaultDomainOptional> <ShowTextLabels>1</ShowTextLabels> <AutomaticCorrectLoginSettings>0</AutomaticCorrectLoginSettings> <EnableLogging>0</EnableLogging> <AllowAjax>1</AllowAjax> <MailsPerPage>20</MailsPerPage> <AttachmentSizeLimit>10000000</AttachmentSizeLimit> <EnableAttachmentSizeLimit>0</EnableAttachmentSizeLimit> <MailboxSizeLimit>90000000</MailboxSizeLimit> <EnableMailboxSizeLimit>0</EnableMailboxSizeLimit> <DefaultTimeZone>0</DefaultTimeZone> <DefaultUserCharset>0</DefaultUserCharset> <DefaultSkin>Hotmail_Style</DefaultSkin> <DefaultLanguage>English</DefaultLanguage> <ViewMode>1</ViewMode> </Settings>