/// <summary> /// Initializes the specified item. /// </summary> /// <param name="item">The item.</param> public virtual void Initialize(CategoryPropertyItem item) { if (item == null) { ThrowHelper.ThrowArgumentNullException("item"); } if (item.PropertyItems != null) { bool negation = false; if (ConfigurationAccessHelper.ParseBooleanValue(item.PropertyItems, CONFIG_NEGATION, ref negation)) { this.Negation = negation; } } }
/// <summary> /// Initializes the channel. /// </summary> /// <param name="pi">The pi.</param> public virtual void Initialize(CategoryPropertyItem pi) { DoDisposeCheck(); if (pi == null) { ThrowHelper.ThrowArgumentNullException("pi"); } if (!mInitialized) { { this.mConnectionData = null; CategoryPropertyItem item = ConfigurationAccessHelper.GetCategoryPropertyByPath(pi.PropertyItems, "RemoteAddress"); if (item != null) { this.mConnectionData = AddressEndPoint.Parse(item.EntryValue); } if (item != null) { ConfigurationAccessHelper.ParseLongValue(pi.PropertyItems, "DefaultErrorResponseTimeout", Timeout.Infinite, long.MaxValue, ref mDefaultErrorResponseTimeout); } } { mServerEndpoints.Clear(); CategoryPropertyItem baseAddressesItems = ConfigurationAccessHelper.GetCategoryPropertyByPath(pi.PropertyItems, "BaseAddresses"); if (baseAddressesItems != null) { IEnumerator <CategoryPropertyItem> iterator = baseAddressesItems.GetEnumerator(); while (iterator.MoveNext()) { mServerEndpoints.Add(AddressEndPoint.Parse(iterator.Current.EntryValue)); } } } { mSessionReusable = true; ConfigurationAccessHelper.ParseBooleanValue(pi.PropertyItems, "SessionReusable", ref mSessionReusable); } } }
private static void SectionHandler_OnConfigurationChanged(object sender, EventArgs e) { CategoryPropertyItem rootItem = ConfigurationAccessHelper.GetCategoryPropertyByPath(RemoteDesktopConfiguration.Settings.CategoryPropertyItems, CONFIG_ROOT); if (rootItem != null) { AuthenticationModeEnum authMode = AuthenticationModeEnum.OnlyPassword; if (ConfigurationAccessHelper.ParseEnumValue <AuthenticationModeEnum>(rootItem.PropertyItems, CONFIG_AUTHENTICATION_MODE, ref authMode)) { AuthenticationMode = authMode; } string moduleStore = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(rootItem.PropertyItems, CONFIG_AUTHENTICATION_MODULE_STORE, ref moduleStore)) { mAuthenticationModuleStore = moduleStore; } bool propagateOnNetwork = true; if (ConfigurationAccessHelper.ParseBooleanValue(rootItem.PropertyItems, CONFIG_PROPAGATE_ON_NETWORK, ref propagateOnNetwork)) { PropagateServiceOnTheNetwork = propagateOnNetwork; } DesktopShareModeEnum desktopShareMode = DesktopShareModeEnum.Shared; if (ConfigurationAccessHelper.ParseEnumValue <DesktopShareModeEnum>(rootItem.PropertyItems, CONFIG_DESKTOP_SHARE_MODE, ref desktopShareMode)) { DesktopShareMode = desktopShareMode; } bool acceptKeyboardAndMouseInputFromClients = true; if (ConfigurationAccessHelper.ParseBooleanValue(rootItem.PropertyItems, CONFIG_ACCEPT_INPUTS_FROM_CLIENTS, ref acceptKeyboardAndMouseInputFromClients)) { AcceptKeyboardAndMouseInputFromClients = acceptKeyboardAndMouseInputFromClients; } int desktopImageClipWidth = Consts.DEFAULT_DESKTOP_IMAGE_CLIP_SIZE; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_DESKTOP_IMAGE_CLIP_WIDTH, Consts.MINIMAL_CLIP_SIZE, int.MaxValue, ref desktopImageClipWidth)) { DesktopImageClipWidth = desktopImageClipWidth; } int desktopImageClipHeight = Consts.DEFAULT_DESKTOP_IMAGE_CLIP_SIZE; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_DESKTOP_IMAGE_CLIP_WIDTH, Consts.MINIMAL_CLIP_SIZE, int.MaxValue, ref desktopImageClipHeight)) { DesktopImageClipHeight = desktopImageClipHeight; } int clientsPerServiceThreads = Consts.DEFAULT_CLIENTS_PER_SERVICE_THREADS; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_DESKTOP_IMAGE_CLIP_WIDTH, Consts.MINIMAL_CLIENTS_PER_SERVICE_THREADS, int.MaxValue, ref clientsPerServiceThreads)) { ClientsPerServiceThreads = clientsPerServiceThreads; } int maximumFailedLoginAttempt = Consts.DEFAULT_MAXIMUM_FAILED_LOGIN_ATTEMPT; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_MAXIMUM_FAILED_LOGIN_ATTEMPT, 0, int.MaxValue, ref maximumFailedLoginAttempt)) { MaximumFailedLoginAttempt = maximumFailedLoginAttempt; } int blackListTimeout = Consts.DEFAULT_BLACKLIST_TIMEOUT_IN_MINUTES; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_BLACKLIST_TIMEOUT, 0, int.MaxValue, ref blackListTimeout)) { BlackListTimeout = blackListTimeout; } int imageClipQuality = Consts.DEFAULT_IMAGE_CLIP_QUALITY; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_IMAGE_CLIP_QUALITY, 10, 100, ref imageClipQuality)) { DefaultImageClipQuality = imageClipQuality; } int mouseMoveSendingInterval = Consts.DEFAULT_MOUSE_MOVE_SEND_INTERVAL; if (ConfigurationAccessHelper.ParseIntValue(rootItem.PropertyItems, CONFIG_MOUSE_MOVE_SEND_INTERVAL, 0, int.MaxValue, ref mouseMoveSendingInterval)) { MouseMoveSendInterval = mouseMoveSendingInterval; } } Raiser.CallDelegatorBySync(EventConfigurationChanged, new object[] { null, EventArgs.Empty }); }
/// <summary> /// Initializes the specified item. /// </summary> /// <param name="item">The item.</param> public override void Initialize(CategoryPropertyItem item) { if (item == null) { ThrowHelper.ThrowArgumentNullException("item"); } base.Initialize(item); SmtpAppender.SmtpAuthentication authMode = SmtpAppender.SmtpAuthentication.None; if (ConfigurationAccessHelper.ParseEnumValue <SmtpAppender.SmtpAuthentication>(item.PropertyItems, CONFIG_AUTHENTICATION, ref authMode)) { this.Authentication = authMode; } string bcc = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_BCC, ref bcc)) { this.Bcc = bcc; } #region Body Encoding string bodyEncoding = "Default"; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_BODYENCODING, ref bodyEncoding)) { switch (bodyEncoding) { case "Default": { this.BodyEncoding = Encoding.Default; } break; case "ASCII": { this.BodyEncoding = Encoding.ASCII; } break; case "BigEndianUnicode": { this.BodyEncoding = Encoding.BigEndianUnicode; } break; case "Unicode": { this.BodyEncoding = Encoding.Unicode; } break; case "UTF32": { this.BodyEncoding = Encoding.UTF32; } break; case "UTF7": { this.BodyEncoding = Encoding.UTF7; } break; case "UTF8": { this.BodyEncoding = Encoding.UTF8; } break; case "": case null: break; default: { this.BodyEncoding = Encoding.GetEncoding(bodyEncoding); } break; } } #endregion string cc = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_CC, ref cc)) { this.Cc = cc; } bool enableSsl = false; if (ConfigurationAccessHelper.ParseBooleanValue(item.PropertyItems, CONFIG_ENABLESSL, ref enableSsl)) { this.EnableSsl = enableSsl; } string from = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_FROM, ref from)) { this.From = from; } string password = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_PASSWORD, ref password)) { this.Password = password; } int port = 25; if (ConfigurationAccessHelper.ParseIntValue(item.PropertyItems, CONFIG_PORT, 1, 65535, ref port)) { this.Port = port; } MailPriority prio = MailPriority.Normal; if (ConfigurationAccessHelper.ParseEnumValue <MailPriority>(item.PropertyItems, CONFIG_MAILPRIORITY, ref prio)) { this.Priority = prio; } string replyTo = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_REPLYTO, ref replyTo)) { this.ReplyTo = replyTo; } string pattern = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_LAYOUT_PATTERN, ref pattern)) { this.ConversionPattern = pattern; } else { this.ConversionPattern = DEFAULT_LAYOUT_PATTERN; } string smtpHost = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_SMTP_HOST, ref smtpHost)) { this.SmtpHost = smtpHost; } string subject = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_SUBJECT, ref subject)) { this.Subject = subject; } #region Subject Encoding string subjectEncoding = "Default"; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_SUBJECTENCODING, ref subjectEncoding)) { switch (bodyEncoding) { case "Default": { this.SubjectEncoding = Encoding.Default; } break; case "ASCII": { this.SubjectEncoding = Encoding.ASCII; } break; case "BigEndianUnicode": { this.SubjectEncoding = Encoding.BigEndianUnicode; } break; case "Unicode": { this.SubjectEncoding = Encoding.Unicode; } break; case "UTF32": { this.SubjectEncoding = Encoding.UTF32; } break; case "UTF7": { this.SubjectEncoding = Encoding.UTF7; } break; case "UTF8": { this.SubjectEncoding = Encoding.UTF8; } break; case "": case null: break; default: { this.SubjectEncoding = Encoding.GetEncoding(bodyEncoding); } break; } } #endregion string to = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_TO, ref to)) { this.To = to; } string username = string.Empty; if (ConfigurationAccessHelper.ParseStringValue(item.PropertyItems, CONFIG_USERNAME, ref username)) { this.Username = username; } LOGGER.Info(string.Format("{0}, Authentication: {1}, Bcc: {2}, BodyEncoding: {3}, Cc: {4}, EnableSSL: {5}, From: {6}, Password: {7}, Port: {8}, Priority: {9}, ReplyTo: {10}, SmtpHost: {11}, SubjectEncoding: {12}, To: {13}, Username: {14}", this.GetType().Name, this.Authentication.ToString(), this.Bcc, this.BodyEncoding.EncodingName, this.Cc, this.EnableSsl.ToString(), this.From, string.IsNullOrEmpty(this.Password) ? "not set" : "exist", this.Port.ToString(), this.Priority.ToString(), this.ReplyTo, this.SmtpHost, this.SubjectEncoding.EncodingName, this.To, this.Username)); this.IsInitialized = true; }