private string FormatPropertyParagraph(string propName, object value) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(propName + ": "); StringBuilder stringBuilder2 = new StringBuilder(); if (value == null) { stringBuilder2.Append(string.Empty); } else if (value is Enum) { stringBuilder2.Append(LocalizedDescriptionAttribute.FromEnum(value.GetType(), value)); } else { if (value is Array) { using (IEnumerator enumerator = ((Array)value).GetEnumerator()) { while (enumerator.MoveNext()) { object obj = enumerator.Current; stringBuilder2.Append(" " + obj.ToString()); } goto IL_AB; } } stringBuilder2.Append(value.ToString()); } IL_AB: stringBuilder.Append(stringBuilder2.ToString()); return(stringBuilder.ToString()); }
public string ToString(bool handleCustomNames) { if (this.mode == ScheduleMode.Never) { return(LocalizedDescriptionAttribute.FromEnum(typeof(ScheduleMode), ScheduleMode.Never)); } if (this.mode == ScheduleMode.Always) { return(LocalizedDescriptionAttribute.FromEnum(typeof(ScheduleMode), ScheduleMode.Always)); } if (handleCustomNames && this.scheduleName != null) { return(this.scheduleName); } StringBuilder stringBuilder = new StringBuilder(); foreach (ScheduleInterval scheduleInterval in this.intervals) { stringBuilder.Append(scheduleInterval.ToString()); stringBuilder.Append(", "); } if (stringBuilder.Length > 0) { stringBuilder.Remove(stringBuilder.Length - 2, 2); } return(stringBuilder.ToString()); }
private static string AtomToString(object item) { string text = string.Empty; if (item != null) { if (item is Enum) { text = LocalizedDescriptionAttribute.FromEnum(item.GetType(), item); } else if (item is ADObjectId) { ADObjectId adobjectId = (ADObjectId)item; text = ((!string.IsNullOrEmpty(adobjectId.Name)) ? adobjectId.Name : adobjectId.ToString()); } else if (item is CultureInfo) { text = ((CultureInfo)item).DisplayName; } else if (item is DateTime) { text = ((DateTime)item).ToLongDateString(); } else { text = item.ToString(); } if (string.IsNullOrEmpty(text)) { text = string.Empty; } } return(text); }
protected override void OnLoad(EventArgs e) { if (!string.IsNullOrEmpty(this.EnumType)) { Type type = Type.GetType(this.EnumType); Enum.GetUnderlyingType(type); foreach (object obj in Enum.GetValues(type)) { string value = obj.ToString(); if (string.IsNullOrEmpty(this.AvailabeValues) || this.AvailabeValues.Split(new char[] { ',' }).Any((string each) => each.Equals(value, StringComparison.InvariantCultureIgnoreCase))) { string value2 = this.localizedText ? LocalizedDescriptionAttribute.FromEnum(type, obj) : obj.ToString(); ListItem item = new ListItem(RtlUtil.ConvertToDecodedBidiString(value2, RtlUtil.IsRtl), value); this.Items.Add(item); if (this.DefaultValue != null && value == this.DefaultValue) { this.SelectedValue = value; } } } } base.OnLoad(e); }
protected virtual string FormatObject(string format, object arg, IFormatProvider formatProvider) { string result = this.NullValueText; Type type = arg.GetType(); if (type == typeof(DateTime) && format == null) { format = "F"; } if (type.IsEnum) { result = LocalizedDescriptionAttribute.FromEnum(arg.GetType(), arg); } else if (typeof(IFormattable).IsAssignableFrom(type)) { result = ((IFormattable)arg).ToString(format, formatProvider); } else if (type == typeof(bool)) { result = (((bool)arg) ? Strings.TrueString : Strings.FalseString); } else if (type == typeof(double) || type == typeof(float)) { result = ((double)arg).ToString(TextConverter.DoubleFormatString); } else { result = arg.ToString(); } return(result); }
public static void GetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; string value = string.Empty; dataRow["IsPrecannedRecipientFilterType"] = (dataRow["IsCustomRecipientFilterType"] = (dataRow["IsOtherRecipientFilterType"] = false)); if (dataRow["RecipientFilterType"] != DBNull.Value) { switch ((WellKnownRecipientFilterType)dataRow["RecipientFilterType"]) { case WellKnownRecipientFilterType.Unknown: case WellKnownRecipientFilterType.Legacy: dataRow["IsOtherRecipientFilterType"] = true; value = Strings.CustomFilterDescription((string)dataRow["LdapRecipientFilter"]); break; case WellKnownRecipientFilterType.Custom: dataRow["IsCustomRecipientFilterType"] = true; value = Strings.CustomFilterDescription((string)dataRow["RecipientFilter"]); break; case WellKnownRecipientFilterType.Precanned: dataRow["IsPrecannedRecipientFilterType"] = true; value = LocalizedDescriptionAttribute.FromEnum(typeof(WellKnownRecipientType), dataRow["IncludedRecipients"]); break; default: throw new NotSupportedException("Unkown WellKnownRecipientFilterType: " + dataRow["RecipientFilterType"].ToStringWithNull()); } dataRow["IncludeRecipientDescription"] = value; } }
private string GetLocalizedString(string[] elements) { StringBuilder stringBuilder = new StringBuilder(); foreach (string text in elements) { if (text.Length > 1 && text[0] == '<' && text[text.Length - 1] == '>') { string value = text.Substring(1, text.Length - 2); if (Enum.IsDefined(typeof(GroupNamingPolicyAttributeEnum), value)) { GroupNamingPolicyAttributeEnum groupNamingPolicyAttributeEnum = (GroupNamingPolicyAttributeEnum)Enum.Parse(typeof(GroupNamingPolicyAttributeEnum), value); stringBuilder.AppendFormat("<{0}>", LocalizedDescriptionAttribute.FromEnum(typeof(GroupNamingPolicyAttributeEnum), groupNamingPolicyAttributeEnum)); } else { stringBuilder.Append(DistributionGroupNamingPolicy.UnescapeText(text)); } } else { stringBuilder.Append(DistributionGroupNamingPolicy.UnescapeText(text)); } } return(stringBuilder.ToString()); }
public static string EnumToLocalizedString(object value) { if (value.GetType().Equals(typeof(DBNull))) { return(string.Empty); } return(LocalizedDescriptionAttribute.FromEnum(value.GetType(), value)); }
public static string GetRepairUrgencyDisplayString(RepairUrgency urgency) { string text = LocalizedDescriptionAttribute.FromEnum(typeof(RepairUrgency), urgency); if (!string.IsNullOrWhiteSpace(text)) { return(text); } return(urgency.ToString()); }
protected override string GetValueText(object objectValue) { string result = string.Empty; if (this.enumType.IsInstanceOfType(objectValue)) { result = LocalizedDescriptionAttribute.FromEnum(this.enumType, objectValue); } return(result); }
protected override void CreateChildControls() { base.CreateChildControls(); this.checkBoxList = new EnumCheckBoxList(); this.checkBoxList.ID = "checklist"; this.checkBoxList.Items.AddRange((from e in Enum.GetNames(typeof(IncidentReportContent)) select new ListItem(LocalizedDescriptionAttribute.FromEnum(typeof(IncidentReportContent), Enum.Parse(typeof(IncidentReportContent), e)), e.ToString())).ToArray <ListItem>()); this.checkBoxList.CellSpacing = 2; this.Controls.Add(this.checkBoxList); }
private static string GetTransitionStateString(TransitionState state) { string text = LocalizedDescriptionAttribute.FromEnum(typeof(TransitionState), state); if (!string.IsNullOrWhiteSpace(text)) { return(text); } return(state.ToString()); }
protected override string FormatObject(string format, object arg, IFormatProvider formatProvider) { if (Enum.IsDefined(typeof(PublicFolderPermissionRole), (int)arg)) { return(LocalizedDescriptionAttribute.FromEnum(typeof(PublicFolderPermissionRole), (int)arg)); } if (PublicFolderPermission.None.Equals(arg)) { return(Strings.PublicFolderPermissionRoleNone); } return(Strings.PublicFolderPermissionRoleCustom); }
public static FlaggedForActionCondition Create(Rule rule, string action) { Condition.CheckParams(new object[] { rule }); RequestedAction requestedAction; if (!RequestedAction.Any.ToString().Equals(action, StringComparison.OrdinalIgnoreCase) && EnumValidator.TryParse <RequestedAction>(action, EnumParseOptions.IgnoreCase, out requestedAction)) { return(new FlaggedForActionCondition(rule, LocalizedDescriptionAttribute.FromEnum(FlaggedForActionCondition.RequestedActionType, requestedAction))); } return(new FlaggedForActionCondition(rule, action)); }
public static int GetRequestedActionLocalizedStringEnumIndex(string actionString, CultureInfo culture) { Array values = Enum.GetValues(FlaggedForActionCondition.RequestedActionType); for (int i = 0; i < values.Length; i++) { string a = (culture != null) ? LocalizedDescriptionAttribute.FromEnum(FlaggedForActionCondition.RequestedActionType, values.GetValue(i), culture) : LocalizedDescriptionAttribute.FromEnum(FlaggedForActionCondition.RequestedActionType, values.GetValue(i)); if (string.Equals(a, actionString, StringComparison.OrdinalIgnoreCase)) { return(i); } } return(-1); }
public static string AuthenticationMethodsToText(object authen) { ADMultiValuedProperty <AuthenticationMethod> admultiValuedProperty = (ADMultiValuedProperty <AuthenticationMethod>)authen; StringBuilder stringBuilder = new StringBuilder(); foreach (AuthenticationMethod authenticationMethod in admultiValuedProperty) { stringBuilder.AppendFormat("{0}, ", LocalizedDescriptionAttribute.FromEnum(typeof(AuthenticationMethod), authenticationMethod)); } return(stringBuilder.ToString().TrimEnd(new char[] { ',', ' ' })); }
private static string GetLocalizedRetentionAction(bool retentionEnabled, RetentionActionType retentionActionType) { string result = LocalizedDescriptionAttribute.FromEnum(typeof(RetentionActionType), retentionActionType); bool flag = retentionActionType == RetentionActionType.MoveToArchive; if (retentionActionType == RetentionActionType.DeleteAndAllowRecovery) { result = Strings.RetentionActionDeleteAndAllowRecovery; } if (!retentionEnabled) { if (flag) { result = Strings.RetentionActionNeverMove; } else { result = Strings.RetentionActionNeverDelete; } } return(result); }
private static void ReplaceLogFieldTags(StringBuilder sb, Globals.LogFields logField, object value) { sb = sb.Replace(logField.ToLabelTag(), LocalizedDescriptionAttribute.FromEnum(typeof(Globals.LogFields), logField) + ":"); sb = sb.Replace(logField.ToValueTag(), string.Format("{0}", value)); }
private static string CreateMailBody(string templateName, MailboxDiscoverySearch searchObject, string[] statusMailRecipients, List <string> successfulMailboxes, List <string> unsuccessfulMailboxes, IList <ISource> srcMailboxes) { Util.ThrowIfNullOrEmpty(templateName, "templateName"); Util.ThrowIfNull(searchObject, "searchObject"); StringBuilder stringBuilder = new StringBuilder(); using (StreamReader streamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(templateName))) { stringBuilder.Append(streamReader.ReadToEnd()); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Identity, searchObject.Identity.ToString()); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.LastStartTime, searchObject.LastStartTime); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.LastEndTime, searchObject.LastEndTime); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.CreatedBy, searchObject.CreatedBy); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Name, searchObject.Name); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.SearchQuery, searchObject.Query); string text = searchObject.Senders.AggregateOfDefault((string s, string x) => s + ", " + x); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Senders, text.ValueOrDefault(Strings.LogMailAll)); text = searchObject.Recipients.AggregateOfDefault((string s, string x) => s + ", " + x); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Recipients, text.ValueOrDefault(Strings.LogMailAll)); text = ((searchObject.StartDate != null) ? string.Format("{0}, {0:%z}", searchObject.StartDate.Value) : Strings.LogMailBlank); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.StartDate, text); text = ((searchObject.EndDate != null) ? string.Format("{0}, {0:%z}", searchObject.EndDate.Value) : Strings.LogMailBlank); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.EndDate, text); text = (from x in searchObject.MessageTypes select x.ToString()).AggregateOfDefault((string s, string x) => s + ", " + x); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.MessageTypes, text.ValueOrDefault(Strings.LogMailAll)); if (searchObject.StatisticsOnly) { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.TargetMailbox, Strings.LogMailNone); } else { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.TargetMailbox, searchObject.Target); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.LogLevel, searchObject.LogLevel); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ExcludeDuplicateMessages, searchObject.ExcludeDuplicateMessages); StringBuilder sb = stringBuilder; Globals.LogFields logField = Globals.LogFields.SourceRecipients; object value; if (srcMailboxes != null) { value = string.Join(", ", (from src in srcMailboxes select src.Id).ToArray <string>()); } else { value = null; } Util.ReplaceLogFieldTags(sb, logField, value); text = statusMailRecipients.AggregateOfDefault((string s, string x) => s + ", " + x); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.StatusMailRecipients, text.ValueOrDefault(Strings.LogMailNone)); text = (from x in searchObject.ManagedBy select x.ToString()).AggregateOfDefault((string s, string x) => s + ", " + x); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ManagedBy, text.ValueOrDefault(Strings.LogMailNone)); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.LastRunBy, searchObject.LastModifiedBy); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.NumberMailboxesToSearch, searchObject.NumberOfMailboxes); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.NumberSuccessfulMailboxes, (successfulMailboxes == null) ? 0 : successfulMailboxes.Count); text = null; if (successfulMailboxes != null && successfulMailboxes.Count > 0) { text = (from x in successfulMailboxes select x).AggregateOfDefault((string s, string x) => s + ", " + x); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.SuccessfulMailboxes, string.IsNullOrEmpty(text) ? Strings.LogMailNone : text); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.NumberUnsuccessfulMailboxes, (unsuccessfulMailboxes == null) ? 0 : unsuccessfulMailboxes.Count); text = null; if (unsuccessfulMailboxes != null && unsuccessfulMailboxes.Count > 0) { text = (from x in unsuccessfulMailboxes select x).AggregateOfDefault((string s, string x) => s + ", " + x); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.UnsuccessfulMailboxes, string.IsNullOrEmpty(text) ? Strings.LogMailNone : text); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Resume, searchObject.Resume); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.IncludeKeywordStatistics, searchObject.IncludeKeywordStatistics); if (searchObject.Status == SearchState.Stopped || searchObject.Status == SearchState.EstimateStopped) { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.StoppedBy, searchObject.LastModifiedBy); } else { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.StoppedBy, Strings.LogMailNotApplicable); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.PercentComplete, string.Format("{0}%", searchObject.PercentComplete)); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ResultSize, new ByteQuantifiedSize((ulong)searchObject.ResultSizeCopied)); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ResultSizeEstimate, searchObject.ResultSizeEstimate); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ResultSizeCopied, new ByteQuantifiedSize((ulong)searchObject.ResultSizeCopied)); if (searchObject.StatisticsOnly) { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ResultsLink, string.Empty); } else { Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.ResultsLink, searchObject.ResultsLink); } int num = Math.Min(Util.MaxNumberOfErrorsInStatusMessage, searchObject.Errors.Count); StringBuilder stringBuilder2 = new StringBuilder(); for (int i = 0; i < num; i++) { stringBuilder2.Append(searchObject.Errors[i]); } text = stringBuilder2.ToString(); Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.Errors, text.ValueOrDefault(Strings.LogMailNone)); KeywordHit unsearchableHit = null; StringBuilder stringBuilder3 = new StringBuilder(); if (searchObject.KeywordHits != null && searchObject.KeywordHits.Count > 0) { stringBuilder3.AppendLine("<table style=\"width: 100%\" cellspacing=\"0\">"); stringBuilder3.AppendFormat("<tr> <td class=\"lefttd\"><strong>{0}</strong> </td><td class=\"lefttd\"><strong>{1}</strong> </td><td class=\"rightttd\"><strong>{2}</strong></td></tr>", Strings.LogFieldsKeywordKeyword, Strings.LogFieldsKeywordHitCount, Strings.LogFieldsKeywordMbxs); foreach (KeywordHit keywordHit in searchObject.KeywordHits) { if (keywordHit.Phrase != "652beee2-75f7-4ca0-8a02-0698a3919cb9") { stringBuilder3.AppendFormat("<tr><td class=\"lefttd\">{0} </td><td class=\"lefttd\">{1} </td><td class=\"rightttd\">{2}</td></tr>", keywordHit.Phrase, keywordHit.Count, keywordHit.MailboxCount); } else { unsearchableHit = keywordHit; } } stringBuilder3.Append("</table>"); } else if (!searchObject.StatisticsOnly) { stringBuilder3.Append(Strings.NoKeywordStatsForCopySearch); } else if (string.IsNullOrEmpty(searchObject.Query)) { stringBuilder3.Append(Strings.KeywordHitEmptyQuery); } else { stringBuilder3.Append(Strings.KeywordStatsNotRequested); } Util.ReplaceLogFieldTags(stringBuilder, Globals.LogFields.KeywordHits, stringBuilder3.ToString()); Util.BuildResultNumbers(stringBuilder, searchObject, unsearchableHit); stringBuilder = stringBuilder.Replace(Globals.LogFields.LogMailHeader.ToLabelTag(), Strings.LogMailHeader(searchObject.Name, LocalizedDescriptionAttribute.FromEnum(typeof(SearchState), searchObject.Status))); if (!searchObject.StatisticsOnly) { stringBuilder = stringBuilder.Replace(Globals.LogFields.LogMailHeaderInstructions.ToLabelTag(), Strings.LogMailHeaderInstructions(searchObject.Name)); } else { stringBuilder.Replace(Globals.LogFields.LogMailHeaderInstructions.ToLabelTag(), string.Empty); } stringBuilder = stringBuilder.Replace(Globals.LogFields.LogMailSeeAttachment.ToLabelTag(), Strings.LogMailSeeAttachment); stringBuilder = stringBuilder.Replace(Globals.LogFields.LogMailFooter.ToLabelTag(), Strings.LogMailFooter); return(stringBuilder.ToString()); }
public NotAllowedPublishingByPolicyException(DetailLevelEnumType detailLevel, DetailLevelEnumType maxAllowedDetailLevel) : base(ServerStrings.DetailLevelNotAllowedByPolicy(LocalizedDescriptionAttribute.FromEnum(typeof(DetailLevelEnumType), detailLevel))) { EnumValidator.ThrowIfInvalid <DetailLevelEnumType>(detailLevel, "detailLevel"); EnumValidator.ThrowIfInvalid <DetailLevelEnumType>(maxAllowedDetailLevel, "maxAllowedDetailLevel"); this.MaxAllowedDetailLevel = (int)maxAllowedDetailLevel; }
// Token: 0x0600106A RID: 4202 RVA: 0x000320D0 File Offset: 0x000302D0 public override object GetValue(int ordinal) { ExTraceGlobals.DataTracer.Information <int>((long)this.GetHashCode(), "-->MonadDataReader.GetValue({0})", ordinal); this.AssertReaderIsOpen(); object result; try { object obj = null; if (this.HasSchema && this.currentRecord != null) { if (this.useBaseObject) { if (ordinal == 0) { obj = this.currentRecord.BaseObject; } } else { COPropertyInfo copropertyInfo = this.properties[ordinal]; if (copropertyInfo != null) { if (string.Equals(copropertyInfo.Name, this.preservedObjectProperty)) { obj = this.currentRecord.BaseObject; } else { PSPropertyInfo pspropertyInfo = this.currentRecord.Properties[copropertyInfo.Name]; if (pspropertyInfo != null) { obj = pspropertyInfo.Value; if (obj is PSObject) { object obj2 = this.UnWrappPSObject(obj as PSObject); if (obj2 is ArrayList) { obj = obj2; } } if (copropertyInfo.Type == typeof(string) && obj is IList) { obj = this.FormatListToString((IList)obj); } else if (copropertyInfo.Type == typeof(string) && obj != null && obj.GetType().IsEnum) { obj = LocalizedDescriptionAttribute.FromEnum(obj.GetType(), obj); } else if (copropertyInfo.Type == typeof(EnumObject)) { obj = new EnumObject(obj as Enum); } else if (copropertyInfo.Type == typeof(string) && obj != null && obj.GetType() == typeof(bool)) { bool flag = (bool)obj; if (flag) { obj = Strings.TrueString; } else { obj = Strings.FalseString; } } else if (obj != null && obj.GetType() == typeof(string)) { if (copropertyInfo.Type.IsEnum) { obj = Enum.Parse(copropertyInfo.Type, obj as string); } else if (copropertyInfo.Type == typeof(Guid)) { obj = new Guid(obj as string); } } } } } } } ExTraceGlobals.DataTracer.Information((long)this.GetHashCode(), "<--MonadDataReader.GetValue(), {0}", new object[] { obj }); result = obj; } catch (GetValueException ex) { Exception innerException = ex.InnerException; while (innerException is TargetInvocationException) { innerException = innerException.InnerException; } if (innerException != null) { result = innerException.Message; } else { result = ex.Message; } } return(result); }
static Schedule() { ScheduleInterval[] array = new ScheduleInterval[168]; for (int i = 0; i < 7; i++) { DayOfWeek startDay = (DayOfWeek)i; DayOfWeek endDay = (DayOfWeek)i; for (int j = 0; j < 24; j++) { array[i * 24 + j] = new ScheduleInterval(startDay, j, 0, endDay, j, 15); array[i * 24 + j] = new ScheduleInterval(startDay, j, 30, endDay, j, 45); } } Schedule.EveryHalfHour = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.EveryHalfHour), array); ScheduleInterval[] array2 = new ScheduleInterval[168]; for (int k = 0; k < 7; k++) { DayOfWeek startDay2 = (DayOfWeek)k; DayOfWeek endDay2 = (DayOfWeek)k; for (int l = 0; l < 24; l++) { array2[k * 24 + l] = new ScheduleInterval(startDay2, l, 0, endDay2, l, 15); } } Schedule.EveryHour = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.EveryHour), array2); ScheduleInterval[] array3 = new ScheduleInterval[84]; for (int m = 0; m < 7; m++) { DayOfWeek startDay3 = (DayOfWeek)m; DayOfWeek endDay3 = (DayOfWeek)m; for (int n = 0; n < 12; n++) { array3[m * 12 + n] = new ScheduleInterval(startDay3, n * 2, 0, endDay3, n * 2, 15); } } Schedule.EveryTwoHours = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.EveryTwoHours), array3); ScheduleInterval[] array4 = new ScheduleInterval[42]; for (int num = 0; num < 7; num++) { DayOfWeek startDay4 = (DayOfWeek)num; DayOfWeek endDay4 = (DayOfWeek)num; for (int num2 = 0; num2 < 6; num2++) { array4[num * 6 + num2] = new ScheduleInterval(startDay4, num2 * 4, 0, endDay4, num2 * 4, 15); } } Schedule.EveryFourHours = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.EveryFourHours), array4); Schedule.DailyFrom8AMTo5PMAtWeekDays = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.DailyFrom8AMTo5PMAtWeekDays), new ScheduleInterval[] { new ScheduleInterval(DayOfWeek.Monday, 8, 0, DayOfWeek.Monday, 17, 0), new ScheduleInterval(DayOfWeek.Tuesday, 8, 0, DayOfWeek.Tuesday, 17, 0), new ScheduleInterval(DayOfWeek.Wednesday, 8, 0, DayOfWeek.Wednesday, 17, 0), new ScheduleInterval(DayOfWeek.Thursday, 8, 0, DayOfWeek.Thursday, 17, 0), new ScheduleInterval(DayOfWeek.Friday, 8, 0, DayOfWeek.Friday, 17, 0) }); Schedule.DailyFrom9AMTo5PMAtWeekDays = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.DailyFrom9AMTo5PMAtWeekDays), new ScheduleInterval[] { new ScheduleInterval(DayOfWeek.Monday, 9, 0, DayOfWeek.Monday, 17, 0), new ScheduleInterval(DayOfWeek.Tuesday, 9, 0, DayOfWeek.Tuesday, 17, 0), new ScheduleInterval(DayOfWeek.Wednesday, 9, 0, DayOfWeek.Wednesday, 17, 0), new ScheduleInterval(DayOfWeek.Thursday, 9, 0, DayOfWeek.Thursday, 17, 0), new ScheduleInterval(DayOfWeek.Friday, 9, 0, DayOfWeek.Friday, 17, 0) }); Schedule.DailyFrom9AMTo6PMAtWeekDays = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.DailyFrom9AMTo6PMAtWeekDays), new ScheduleInterval[] { new ScheduleInterval(DayOfWeek.Monday, 9, 0, DayOfWeek.Monday, 18, 0), new ScheduleInterval(DayOfWeek.Tuesday, 9, 0, DayOfWeek.Tuesday, 18, 0), new ScheduleInterval(DayOfWeek.Wednesday, 9, 0, DayOfWeek.Wednesday, 18, 0), new ScheduleInterval(DayOfWeek.Thursday, 9, 0, DayOfWeek.Thursday, 18, 0), new ScheduleInterval(DayOfWeek.Friday, 9, 0, DayOfWeek.Friday, 18, 0) }); Schedule.DailyFrom8AMTo12PMAnd1PMTo5PMAtWeekDays = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.DailyFrom8AMTo12PMAnd1PMTo5PMAtWeekDays), new ScheduleInterval[] { new ScheduleInterval(DayOfWeek.Monday, 8, 0, DayOfWeek.Monday, 12, 0), new ScheduleInterval(DayOfWeek.Tuesday, 8, 0, DayOfWeek.Tuesday, 12, 0), new ScheduleInterval(DayOfWeek.Wednesday, 8, 0, DayOfWeek.Wednesday, 12, 0), new ScheduleInterval(DayOfWeek.Thursday, 8, 0, DayOfWeek.Thursday, 12, 0), new ScheduleInterval(DayOfWeek.Friday, 8, 0, DayOfWeek.Friday, 12, 0), new ScheduleInterval(DayOfWeek.Monday, 13, 0, DayOfWeek.Monday, 17, 0), new ScheduleInterval(DayOfWeek.Tuesday, 13, 0, DayOfWeek.Tuesday, 17, 0), new ScheduleInterval(DayOfWeek.Wednesday, 13, 0, DayOfWeek.Wednesday, 17, 0), new ScheduleInterval(DayOfWeek.Thursday, 13, 0, DayOfWeek.Thursday, 17, 0), new ScheduleInterval(DayOfWeek.Friday, 13, 0, DayOfWeek.Friday, 17, 0) }); Schedule.DailyFrom9AMTo12PMAnd1PMTo6PMAtWeekDays = Schedule.CreateCustomSchedule(LocalizedDescriptionAttribute.FromEnum(typeof(CustomScheduleName), CustomScheduleName.DailyFrom9AMTo12PMAnd1PMTo6PMAtWeekDays), new ScheduleInterval[] { new ScheduleInterval(DayOfWeek.Monday, 9, 0, DayOfWeek.Monday, 12, 0), new ScheduleInterval(DayOfWeek.Tuesday, 9, 0, DayOfWeek.Tuesday, 12, 0), new ScheduleInterval(DayOfWeek.Wednesday, 9, 0, DayOfWeek.Wednesday, 12, 0), new ScheduleInterval(DayOfWeek.Thursday, 9, 0, DayOfWeek.Thursday, 12, 0), new ScheduleInterval(DayOfWeek.Friday, 9, 0, DayOfWeek.Friday, 12, 0), new ScheduleInterval(DayOfWeek.Monday, 13, 0, DayOfWeek.Monday, 18, 0), new ScheduleInterval(DayOfWeek.Tuesday, 13, 0, DayOfWeek.Tuesday, 18, 0), new ScheduleInterval(DayOfWeek.Wednesday, 13, 0, DayOfWeek.Wednesday, 18, 0), new ScheduleInterval(DayOfWeek.Thursday, 13, 0, DayOfWeek.Thursday, 18, 0), new ScheduleInterval(DayOfWeek.Friday, 13, 0, DayOfWeek.Friday, 18, 0) }); }
private void UpdatePanel() { base.SuspendLayout(); base.CaptionStrip.SuspendLayout(); try { WorkUnit workUnit = this.WorkUnit; if (workUnit != null) { this.Text = workUnit.Text; base.Icon = workUnit.Icon; if (this.descriptionLabel.Links.Count > 0) { this.descriptionLabel.Links.Clear(); } WorkUnitStatus status = workUnit.Status; this.UpdateProgressBar(status); bool flag = true; bool flag2 = true; TaskState taskState = 0; if (base.Parent is WorkUnitsPanel) { taskState = ((WorkUnitsPanel)base.Parent).TaskState; flag = (taskState != null && status != WorkUnitStatus.NotStarted); flag2 = (taskState == null || (taskState == 1 && status == WorkUnitStatus.InProgress) || (taskState == 1 && status == WorkUnitStatus.NotStarted)); } base.StatusVisible = (status != WorkUnitStatus.InProgress); string status2 = LocalizedDescriptionAttribute.FromEnum(typeof(WorkUnitStatus), status); StringBuilder stringBuilder = new StringBuilder(2048); if (flag2) { if (taskState == 1 && status == WorkUnitStatus.InProgress) { string text = (workUnit.StatusDescription == null) ? null : workUnit.StatusDescription.Trim(); if (!string.IsNullOrEmpty(text)) { stringBuilder.AppendLine(Strings.StatusDescription(text)); } } else { string value = (workUnit.Description == null) ? null : workUnit.Description.Trim(); if (!string.IsNullOrEmpty(value)) { stringBuilder.AppendLine(value); } } } string executedCommandTextForWorkUnit = workUnit.ExecutedCommandTextForWorkUnit; switch (status) { case WorkUnitStatus.NotStarted: base.StatusImage = null; base.Status = ""; if (taskState == 1) { base.Status = Strings.WorkUnitStatusPending; } else if (taskState == 2) { base.Status = Strings.WorkUnitStatusCancelled; base.StatusImage = WorkUnitPanel.warning; if (workUnit.CanShowExecutedCommand && !string.IsNullOrEmpty(executedCommandTextForWorkUnit)) { stringBuilder.AppendLine(Strings.MshCommandExecutedFailed(executedCommandTextForWorkUnit)); } } break; case WorkUnitStatus.InProgress: base.Status = ""; base.StatusImage = null; break; case WorkUnitStatus.Completed: if (!flag2) { base.Status = status2; base.StatusImage = ((workUnit.Warnings.Count == 0) ? WorkUnitPanel.completed : WorkUnitPanel.warning); if (workUnit.Warnings.Count > 0) { stringBuilder.AppendLine(workUnit.WarningsDescription); } if (workUnit.CanShowExecutedCommand && !string.IsNullOrEmpty(executedCommandTextForWorkUnit)) { stringBuilder.AppendLine(Strings.MshCommandExecutedSuccessfully(executedCommandTextForWorkUnit)); } } break; case WorkUnitStatus.Failed: if (!flag2) { base.FastSetIsMinimized(false); base.Status = status2; base.StatusImage = WorkUnitPanel.failed; if (workUnit.Errors.Count > 0) { for (int i = 0; i < workUnit.Errors.Count; i++) { stringBuilder.AppendLine(Strings.WorkUnitError); ErrorRecord errorRecord = workUnit.Errors[i]; ErrorDetails errorDetails = errorRecord.ErrorDetails; string text2 = null; if (errorDetails != null && !string.IsNullOrEmpty(errorDetails.RecommendedAction)) { text2 = errorDetails.RecommendedAction; } else { LocalizedException ex = errorRecord.Exception as LocalizedException; if (ex != null) { Uri uri = null; if (Microsoft.Exchange.CommonHelpProvider.HelpProvider.TryGetErrorAssistanceUrl(ex, out uri)) { text2 = uri.ToString(); } } } if (errorDetails != null) { if (!string.IsNullOrEmpty(errorDetails.Message)) { stringBuilder.AppendLine(errorDetails.Message); } } else { Exception ex2 = errorRecord.Exception; string text3 = ""; while (ex2 != null) { if (ex2.Message != text3) { text3 = ex2.Message; stringBuilder.AppendLine(text3); } ex2 = ex2.InnerException; if (ex2 != null) { stringBuilder.AppendLine(); } } } if (!string.IsNullOrEmpty(text2)) { string value2 = Strings.WorkUnitErrorAssistanceLink; LinkLabel.Link link = new LinkLabel.Link(); link.LinkData = text2; link.Start = new StringInfo(stringBuilder.ToString()).LengthInTextElements; link.Length = new StringInfo(value2).LengthInTextElements; this.descriptionLabel.Links.Add(link); stringBuilder.AppendLine(value2); } if (i < workUnit.Errors.Count - 1) { stringBuilder.AppendLine(); } } } if (workUnit.Warnings.Count > 0) { if (workUnit.Errors.Count > 0) { stringBuilder.AppendLine(); } stringBuilder.AppendLine(workUnit.WarningsDescription); } if (workUnit.CanShowExecutedCommand && !string.IsNullOrEmpty(executedCommandTextForWorkUnit)) { if (workUnit.Warnings.Count > 0 || workUnit.Errors.Count > 0) { stringBuilder.AppendLine(); } stringBuilder.AppendLine(Strings.MshCommandExecutedFailed(executedCommandTextForWorkUnit)); } } break; } if (workUnit.CanShowElapsedTime && flag) { stringBuilder.AppendLine(); stringBuilder.AppendLine(workUnit.ElapsedTimeText); } this.Description = stringBuilder.ToString().Trim(); this.TimerEnabled = (status == WorkUnitStatus.InProgress); } } finally { base.CaptionStrip.ResumeLayout(false); base.CaptionStrip.PerformLayout(); base.ResumeLayout(); } }
public static Schedule Parse(string s, bool handleCustomNames, bool normalize) { if (StringComparer.OrdinalIgnoreCase.Compare(s, ScheduleMode.Never.ToString()) == 0 || StringComparer.Ordinal.Compare(s, LocalizedDescriptionAttribute.FromEnum(typeof(ScheduleMode), ScheduleMode.Never)) == 0) { return(Schedule.Never); } if (StringComparer.OrdinalIgnoreCase.Compare(s, ScheduleMode.Always.ToString()) == 0 || StringComparer.Ordinal.Compare(s, LocalizedDescriptionAttribute.FromEnum(typeof(ScheduleMode), ScheduleMode.Always)) == 0) { return(Schedule.Always); } if (handleCustomNames && Schedule.customSchedules.ContainsKey(s)) { return(Schedule.customSchedules[s]); } string[] array = s.Split(new char[] { ',' }); if (array.Length == 1) { return(Schedule.CreateCustomSchedule(null, new ScheduleInterval[] { ScheduleInterval.Parse(s) })); } ScheduleInterval[] array2 = new ScheduleInterval[array.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = ScheduleInterval.Parse(array[i].Trim()); } return(new Schedule(array2, normalize)); }
private string GetErrorMessage() { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair <AuthenticationMechanism, Exception> keyValuePair in this.exceptionList) { stringBuilder.AppendLine(Strings.TryAuthenticationMechanismFailedMessage(this.uri.ToString(), LocalizedDescriptionAttribute.FromEnum(typeof(AuthenticationMechanism), keyValuePair.Key), keyValuePair.Value.Message)); } return(stringBuilder.ToString()); }
protected static string GetScenarioDescription(WebServicesTestOutcome.TestScenario scenario) { return(LocalizedDescriptionAttribute.FromEnum(typeof(WebServicesTestOutcome.TestScenario), scenario)); }
protected FeatureLauncherListViewItem() { base.SubItems.Add(new ListViewItem.ListViewSubItem(this, LocalizedDescriptionAttribute.FromEnum(typeof(FeatureStatus), this.Status))); base.UseItemStyleForSubItems = false; }