public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; List <string> list = new List <string>(); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "IssueWarningQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendReceiveQuota", list); if (DBNull.Value != dataRow["DeletedItemRetention"]) { dataRow["DeletedItemRetention"] = EnhancedTimeSpan.Parse((string)dataRow["DeletedItemRetention"]); list.Add("DeletedItemRetention"); } if (DBNull.Value != dataRow["MailboxRetention"]) { dataRow["MailboxRetention"] = EnhancedTimeSpan.Parse((string)dataRow["MailboxRetention"]); list.Add("MailboxRetention"); } DatabasePropertiesHelper.SetScheduleProperty(dataRow, "MaintenanceSchedule", list); DatabasePropertiesHelper.SetScheduleProperty(dataRow, "QuotaNotificationSchedule", list); if (list.Count != 0) { store.SetModifiedColumns(list); } }
protected void InitializeLagTimes(DatabaseCopy preExistingCopy) { if (base.Fields["ReplayLagTime"] == null) { if (preExistingCopy == null) { this.m_replayLagTime = EnhancedTimeSpan.Parse("00:00:00"); } else { this.m_replayLagTime = preExistingCopy.ReplayLagTime; } } else { this.m_replayLagTime = this.ReplayLagTime; } if (base.Fields["TruncationLagTime"] != null) { this.m_truncationLagTime = this.TruncationLagTime; return; } if (preExistingCopy == null) { this.m_truncationLagTime = EnhancedTimeSpan.Parse("00:00:00"); return; } this.m_truncationLagTime = preExistingCopy.TruncationLagTime; }
public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; List <string> list = new List <string>(); if (DBNull.Value != inputRow["IssueWarningQuota"] || DBNull.Value != inputRow["ProhibitPostQuota"] || DBNull.Value != inputRow["MaxItemSize"] || DBNull.Value != inputRow["IsStorageQuotasSet"]) { if (DBNull.Value != inputRow["IsStorageQuotasSet"] && (bool)inputRow["IsStorageQuotasSet"]) { dataRow["IssueWarningQuota"] = Unlimited <ByteQuantifiedSize> .UnlimitedString; dataRow["ProhibitPostQuota"] = Unlimited <ByteQuantifiedSize> .UnlimitedString; dataRow["MaxItemSize"] = Unlimited <ByteQuantifiedSize> .UnlimitedString; } MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "IssueWarningQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "ProhibitPostQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, "IsStorageQuotasSet", "MaxItemSize", list); } if (DBNull.Value != inputRow["RetainDeletedItemsFor"] || DBNull.Value != inputRow["IsRetainDeletedItemsForSet"]) { if (DBNull.Value != inputRow["IsRetainDeletedItemsForSet"] && (bool)inputRow["IsRetainDeletedItemsForSet"]) { dataRow["RetainDeletedItemsFor"] = null; } else { dataRow["RetainDeletedItemsFor"] = EnhancedTimeSpan.Parse((string)dataRow["RetainDeletedItemsFor"]); } list.Add("RetainDeletedItemsFor"); list.Add("IsRetainDeletedItemsForSet"); } if (DBNull.Value != inputRow["AgeLimit"] || DBNull.Value != inputRow["IsAgeLimitSet"]) { if (DBNull.Value != inputRow["IsAgeLimitSet"] && (bool)inputRow["IsAgeLimitSet"]) { dataRow["AgeLimit"] = null; } else { dataRow["AgeLimit"] = EnhancedTimeSpan.Parse((string)dataRow["AgeLimit"]); } list.Add("AgeLimit"); list.Add("IsAgeLimitSet"); } MailboxPropertiesHelper.SetMaxSendReceiveSize(inputRow, dataTable, store); if (list.Count > 0) { store.SetModifiedColumns(list); } }
private ComponentLatencyInfo(PropertyStreamReader reader) { KeyValuePair <string, object> item; reader.Read(out item); if (!string.Equals("NumProperties", item.Key, StringComparison.OrdinalIgnoreCase)) { throw new SerializationException(string.Format("Cannot deserialize ComponentLatencyInfo. Expected property NumProperties, but found property '{0}'", item.Key)); } int value = PropertyStreamReader.GetValue <int>(item); for (int i = 0; i < value; i++) { reader.Read(out item); if (string.Equals("Name", item.Key, StringComparison.OrdinalIgnoreCase)) { this.componentName = new LocalizedString(PropertyStreamReader.GetValue <string>(item)); } else if (string.Equals("Latency", item.Key, StringComparison.OrdinalIgnoreCase)) { this.componentLatency = EnhancedTimeSpan.Parse(PropertyStreamReader.GetValue <string>(item)); } else if (string.Equals("SequenceNumber", item.Key, StringComparison.OrdinalIgnoreCase)) { this.componentSequenceNumber = PropertyStreamReader.GetValue <int>(item); } else if (string.Equals("Pending", item.Key, StringComparison.OrdinalIgnoreCase)) { this.isPending = PropertyStreamReader.GetValue <bool>(item); } else { ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Ignoring unknown property '{0} in ComponentLatencyInfo", item.Key); } } }
protected static object GetSingleProperty(object prop, Type type) { if (prop == null) { return(null); } object obj = null; if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>)) { obj = MockObjectCreator.GetSingleProperty(prop, type.GetGenericArguments()[0]); } else if (type == typeof(ADObjectId) && prop is PSObject) { obj = new ADObjectId(((PSObject)prop).Members["DistinguishedName"].Value.ToString(), new Guid(((PSObject)prop).Members["ObjectGuid"].Value.ToString())); } else if (type == typeof(EnhancedTimeSpan)) { obj = EnhancedTimeSpan.Parse(prop.ToString()); } else if (type == typeof(Unlimited <EnhancedTimeSpan>)) { obj = Unlimited <EnhancedTimeSpan> .Parse(prop.ToString()); } else if (type == typeof(ByteQuantifiedSize)) { obj = ByteQuantifiedSize.Parse(prop.ToString()); } else if (type == typeof(Unlimited <ByteQuantifiedSize>)) { obj = Unlimited <ByteQuantifiedSize> .Parse(prop.ToString()); } else if (type == typeof(Unlimited <int>)) { obj = Unlimited <int> .Parse(prop.ToString()); } else if (type == typeof(ProxyAddress)) { obj = ProxyAddress.Parse(prop.ToString()); } else if (type == typeof(SmtpAddress)) { obj = new SmtpAddress(prop.ToString()); } else if (type == typeof(SmtpDomain)) { obj = SmtpDomain.Parse(prop.ToString()); } else if (type == typeof(CountryInfo)) { obj = CountryInfo.Parse(prop.ToString()); } else if (type == typeof(SharingPolicyDomain)) { obj = SharingPolicyDomain.Parse(prop.ToString()); } else if (type == typeof(ApprovedApplication)) { obj = ApprovedApplication.Parse(prop.ToString()); } else if (type == typeof(SmtpDomainWithSubdomains)) { obj = SmtpDomainWithSubdomains.Parse(prop.ToString()); } else if (type == typeof(UMLanguage)) { obj = UMLanguage.Parse(prop.ToString()); } else if (type == typeof(UMSmartHost)) { obj = UMSmartHost.Parse(prop.ToString()); } else if (type == typeof(ScheduleInterval)) { obj = ScheduleInterval.Parse(prop.ToString()); } else if (type == typeof(NumberFormat)) { obj = NumberFormat.Parse(prop.ToString()); } else if (type == typeof(DialGroupEntry)) { obj = DialGroupEntry.Parse(prop.ToString()); } else if (type == typeof(CustomMenuKeyMapping)) { obj = CustomMenuKeyMapping.Parse(prop.ToString()); } else if (type == typeof(HolidaySchedule)) { obj = HolidaySchedule.Parse(prop.ToString()); } else if (type == typeof(UMTimeZone)) { obj = UMTimeZone.Parse(prop.ToString()); } else if (type == typeof(ServerVersion)) { obj = ServerVersion.ParseFromSerialNumber(prop.ToString()); } else if (type == typeof(X509Certificate2)) { obj = new X509Certificate2(((PSObject)prop).Members["RawData"].Value as byte[]); } else if (type == typeof(LocalizedString)) { obj = new LocalizedString(prop.ToString()); } else if (type == typeof(ExchangeObjectVersion)) { obj = ExchangeObjectVersion.Parse(prop.ToString()); } else if (type == typeof(bool)) { obj = bool.Parse(prop.ToString()); } else if (type == typeof(SecurityPrincipalIdParameter)) { obj = new SecurityPrincipalIdParameter(prop.ToString()); } else if (type == typeof(ActiveDirectoryAccessRule)) { obj = (prop as ActiveDirectoryAccessRule); } else if (type == typeof(ObjectId)) { string text = prop.ToString(); if (!ADObjectId.IsValidDistinguishedName(text) && text.Contains("/")) { text = MockObjectCreator.ConvertDNFromTreeStructure(text); } obj = new ADObjectId(text); } else if (type.IsEnum) { try { obj = Enum.Parse(type, prop.ToString()); } catch (ArgumentException) { obj = Enum.GetValues(type).GetValue(0); } } return(obj ?? prop); }
private PropertyBagBasedMessageInfo(PropertyStreamReader reader, Version sourceVersion) : base(new MessageInfoPropertyBag()) { KeyValuePair <string, object> keyValuePair; reader.Read(out keyValuePair); if (!string.Equals("NumProperties", keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { throw new SerializationException(string.Format("Cannot deserialize PropertyBagBasedMessageInfo. Expected property NumProperties, but found property '{0}'", keyValuePair.Key)); } int value = PropertyStreamReader.GetValue <int>(keyValuePair); for (int i = 0; i < value; i++) { reader.Read(out keyValuePair); if (string.Equals(ExtensibleMessageInfoSchema.Identity.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MessageIdentity value2 = MessageIdentity.Create(sourceVersion, keyValuePair, reader); this.propertyBag[ExtensibleMessageInfoSchema.Identity] = value2; } else if (string.Equals(ExtensibleMessageInfoSchema.Status.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MessageStatus value3 = (MessageStatus)PropertyStreamReader.GetValue <int>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.Status] = value3; } else if (string.Equals(ExtensibleMessageInfoSchema.Size.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize(PropertyStreamReader.GetValue <ulong>(keyValuePair)); this.propertyBag[ExtensibleMessageInfoSchema.Size] = byteQuantifiedSize; } else if (string.Equals(ExtensibleMessageInfoSchema.MessageLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { EnhancedTimeSpan enhancedTimeSpan = EnhancedTimeSpan.Parse(PropertyStreamReader.GetValue <string>(keyValuePair)); this.propertyBag[ExtensibleMessageInfoSchema.MessageLatency] = enhancedTimeSpan; } else if (string.Equals(ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { Guid value4 = PropertyStreamReader.GetValue <Guid>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId] = value4; } else if (string.Equals(ExtensibleMessageInfoSchema.Directionality.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MailDirectionality value5 = (MailDirectionality)PropertyStreamReader.GetValue <int>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.Directionality] = value5; } else if (string.Equals(ExtensibleMessageInfoSchema.Recipients.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { int value6 = PropertyStreamReader.GetValue <int>(keyValuePair); RecipientInfo[] array = new RecipientInfo[value6]; for (int j = 0; j < value6; j++) { RecipientInfo recipientInfo = RecipientInfo.Create(reader); array[j] = recipientInfo; } this.propertyBag[ExtensibleMessageInfoSchema.Recipients] = array; } else if (string.Equals(ExtensibleMessageInfoSchema.ComponentLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { int value7 = PropertyStreamReader.GetValue <int>(keyValuePair); ComponentLatencyInfo[] array2 = new ComponentLatencyInfo[value7]; for (int k = 0; k < value7; k++) { ComponentLatencyInfo componentLatencyInfo = ComponentLatencyInfo.Create(reader); array2[k] = componentLatencyInfo; } this.propertyBag[ExtensibleMessageInfoSchema.ComponentLatency] = array2; } else { PropertyDefinition fieldByName = PropertyBagBasedMessageInfo.schema.GetFieldByName(keyValuePair.Key); if (fieldByName != null) { this.propertyBag.SetField((QueueViewerPropertyDefinition <ExtensibleMessageInfo>)fieldByName, keyValuePair.Value); } else { ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Cannot convert key index '{0}' into a property in the ExtensibleMessageInfo schema", keyValuePair.Key); } } } }