コード例 #1
0
        internal static bool ValidLogSizeCompatibility(Unlimited <ByteQuantifiedSize> logMaxFileSize, Unlimited <ByteQuantifiedSize> logMaxDirectorySize, ADObjectId siteId, ITopologyConfigurationSession session)
        {
            ByteQuantifiedSize value = new ByteQuantifiedSize(2147483647UL);

            if ((!logMaxFileSize.IsUnlimited && logMaxFileSize.Value > value) || (!logMaxDirectorySize.IsUnlimited && logMaxDirectorySize.Value > value))
            {
                AndFilter filter = new AndFilter(new QueryFilter[]
                {
                    new BitMaskAndFilter(ServerSchema.CurrentServerRole, 32UL),
                    new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, siteId)
                });
                foreach (Server server in session.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0))
                {
                    ServerVersion a = new ServerVersion(server.VersionNumber);
                    if (ServerVersion.Compare(a, EdgeSyncServiceConfig.LogSizeBreakageVersion) < 0)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(true);
        }
        // Token: 0x060060EF RID: 24815 RVA: 0x00149200 File Offset: 0x00147400
        internal static void ObjectCountQuotaSetter(string key, Unlimited <int> countQuota, IPropertyBag propertyBag)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[RecipientEnforcementProvisioningPolicySchema.ObjectCountQuota];

            foreach (string text in multiValuedProperty)
            {
                string[] array = text.Split(new char[]
                {
                    ':'
                });
                if (array.Length == 2 && string.Equals(key, array[0], StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.Remove(text);
                    break;
                }
            }
            if (countQuota != Unlimited <int> .UnlimitedValue)
            {
                string item = string.Format("{0}:{1}", key, countQuota);
                multiValuedProperty.Add(item);
            }
            propertyBag[RecipientEnforcementProvisioningPolicySchema.ObjectCountQuota] = multiValuedProperty;
        }
コード例 #3
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            PublicFolderMailboxService.SaveQuotaProperty(dataRow, "UseDatabaseQuotaDefaults", "IssueWarningQuota", list);
            PublicFolderMailboxService.SaveQuotaProperty(dataRow, "UseDatabaseQuotaDefaults", "ProhibitSendReceiveQuota", list);
            Unlimited <ByteQuantifiedSize> unlimited = Unlimited <ByteQuantifiedSize> .UnlimitedValue;

            if (!DBNull.Value.Equals(dataRow["MaxReceiveSize"]))
            {
                list.Add("MaxReceiveSize");
                unlimited = Unlimited <ByteQuantifiedSize> .Parse((string)dataRow["MaxReceiveSize"]);

                store.SetModifiedColumns(list);
            }
            inputRow["MaxReceiveSize"] = unlimited;
            dataRow["MaxReceiveSize"]  = unlimited;
            if (list.Count != 0)
            {
                store.SetModifiedColumns(list);
            }
        }
コード例 #4
0
        // Token: 0x06000F15 RID: 3861 RVA: 0x00059E04 File Offset: 0x00058004
        public static Unlimited <ByteQuantifiedSize> GetTotalItemSize(IPublicFolderMailboxLoggerBase logger, IAssistantRunspaceFactory powershellFactory, Guid mailboxGuid, OrganizationId organizationId, ISplitOperationState splitOperationState)
        {
            Unlimited <ByteQuantifiedSize> totalItemSize = ByteQuantifiedSize.Zero;
            string    value = string.Format("{0}\\{1}", organizationId.OrganizationalUnit.Name, mailboxGuid.ToString());
            PSCommand cmd   = new PSCommand();

            cmd.AddCommand("Get-MailboxStatistics");
            cmd.AddParameter("NoADLookup");
            cmd.AddParameter("Identity", value);
            MailboxStatistics publicFolderMailboxStatistics = null;

            PublicFolderSplitHelper.PowerShellExceptionHandler(delegate(out string originOfException, out ErrorRecord error)
            {
                error             = null;
                originOfException = "GetTotalItemSize - RunPSCommand Get-MailboxStatistics";
                IAssistantRunspaceProxy assistantRunspaceProxy = powershellFactory.CreateRunspaceForDatacenterAdmin(organizationId);
                publicFolderMailboxStatistics = assistantRunspaceProxy.RunPSCommand <MailboxStatistics>(cmd, out error, logger);
                if (error == null && publicFolderMailboxStatistics != null)
                {
                    totalItemSize = publicFolderMailboxStatistics.TotalItemSize;
                }
            }, splitOperationState);
            return(totalItemSize);
        }
コード例 #5
0
        public static void MailboxUsageGetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];
            Mailbox mailbox = store.GetDataObject("Mailbox") as Mailbox;

            if (mailbox != null)
            {
                MailboxStatistics mailboxStatistics = store.GetDataObject("MailboxStatistics") as MailboxStatistics;
                MailboxDatabase   mailboxDatabase   = store.GetDataObject("MailboxDatabase") as MailboxDatabase;
                MailboxStatistics archiveStatistics = store.GetDataObject("ArchiveStatistics") as MailboxStatistics;
                MailboxPropertiesHelper.MailboxUsage mailboxUsage = new MailboxPropertiesHelper.MailboxUsage(mailbox, mailboxDatabase, mailboxStatistics, archiveStatistics);
                dataRow["MailboxUsage"] = new StatisticsBarData(mailboxUsage.MailboxUsagePercentage, mailboxUsage.MailboxUsageState, mailboxUsage.MailboxUsageText);
                if ((mailbox.UseDatabaseQuotaDefaults != null && mailbox.UseDatabaseQuotaDefaults.Value && mailboxDatabase != null && !Util.IsDataCenter) || !mailbox.ProhibitSendQuota.IsUnlimited)
                {
                    dataRow["IsMailboxUsageUnlimited"] = false;
                }
                else
                {
                    dataRow["IsMailboxUsageUnlimited"] = true;
                }
                Unlimited <ByteQuantifiedSize> maxReceiveSize = mailbox.MaxReceiveSize;
                if (maxReceiveSize.IsUnlimited)
                {
                    dataRow["MaxReceiveSize"] = "unlimited";
                }
                else
                {
                    dataRow["MaxReceiveSize"] = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(maxReceiveSize);
                }
                dataRow["IssueWarningQuota"]             = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.IssueWarningQuota);
                dataRow["ProhibitSendQuota"]             = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.ProhibitSendQuota);
                dataRow["ProhibitSendReceiveQuota"]      = PublicFolderMailboxService.UnlimitedByteQuantifiedSizeToString(mailboxUsage.ProhibitSendReceiveQuota);
                dataRow["RetainDeletedItemsFor"]         = mailboxUsage.RetainDeletedItemsFor.Days.ToString();
                dataRow["RetainDeletedItemsUntilBackup"] = mailboxUsage.RetainDeletedItemsUntilBackup;
            }
        }
コード例 #6
0
        public static ITokenBucket Create(ITokenBucket tokenBucket, Unlimited <uint> maxBalance, Unlimited <uint> rechargeRate, Unlimited <uint> minBalance, BudgetKey budgetKey)
        {
            if (rechargeRate == 0U)
            {
                return(new FullyThrottledTokenBucket(tokenBucket));
            }
            if (rechargeRate == 2147483647U || rechargeRate.IsUnlimited)
            {
                return(new UnthrottledTokenBucket(tokenBucket));
            }
            TokenBucket tokenBucket2 = tokenBucket as TokenBucket;

            if (tokenBucket2 != null && tokenBucket2.BudgetKey == budgetKey)
            {
                tokenBucket2.UpdateSettings(maxBalance, rechargeRate, minBalance);
                return(tokenBucket);
            }
            return(new TokenBucket(tokenBucket, maxBalance, rechargeRate, minBalance, budgetKey));
        }
コード例 #7
0
 private TokenBucket(ITokenBucket oldBucket, Unlimited <uint> maxBalance, Unlimited <uint> rechargeRate, Unlimited <uint> minBalance, BudgetKey budgetKey)
 {
     this.BudgetKey     = budgetKey;
     this.LastUpdateUtc = TimeProvider.UtcNow;
     this.UpdateSettings(maxBalance, rechargeRate, minBalance);
     this.balance = (maxBalance.IsUnlimited ? 2147483647U : maxBalance.Value);
     if (oldBucket != null)
     {
         this.PendingCharges = oldBucket.PendingCharges;
     }
 }
コード例 #8
0
 public static ITokenBucket Create(Unlimited <uint> maxBalance, Unlimited <uint> rechargeRate, Unlimited <uint> minBalance, BudgetKey budgetKey)
 {
     return(TokenBucket.Create(null, maxBalance, rechargeRate, minBalance, budgetKey));
 }
コード例 #9
0
 internal static string GetAttachment(MailboxSession mailboxSession, string attachmentId, Stream outStream, Unlimited <ByteQuantifiedSize> maxAttachmentSize, ItemIdMapping idmapping, out int total)
 {
     return(AttachmentHelper.GetAttachment(mailboxSession, attachmentId, outStream, 0, -1, maxAttachmentSize, idmapping, false, out total));
 }
コード例 #10
0
        internal override ExchangeMailbox GetMailboxAdvancedSettingsInternal(string accountName)
        {
            ExchangeLog.LogStart("GetMailboxAdvancedSettingsInternal");
            ExchangeLog.DebugInfo("Account: {0}", accountName);

            ExchangeMailbox info = new ExchangeMailbox();

            info.AccountName = accountName;
            Runspace runSpace = null;

            try
            {
                runSpace = OpenRunspace();

                Collection <PSObject> result = GetMailboxObject(runSpace, accountName);
                PSObject mailbox             = result[0];

                info.IssueWarningKB =
                    ConvertUnlimitedToKB((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "IssueWarningQuota"));
                info.ProhibitSendKB =
                    ConvertUnlimitedToKB((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendQuota"));
                info.ProhibitSendReceiveKB =
                    ConvertUnlimitedToKB((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
                info.KeepDeletedItemsDays =
                    ConvertEnhancedTimeSpanToDays((EnhancedTimeSpan)GetPSObjectProperty(mailbox, "RetainDeletedItemsFor"));

                info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");

                info.RecoverabelItemsSpace =
                    ConvertUnlimitedToKB((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));
                info.RecoverabelItemsWarning =
                    ConvertUnlimitedToKB((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsWarningQuota"));


                //Client Access
                Command cmd = new Command("Get-CASMailbox");
                cmd.Parameters.Add("Identity", accountName);
                result  = ExecuteShellCommand(runSpace, cmd);
                mailbox = result[0];

                info.EnableActiveSync = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled");
                info.EnableOWA        = (bool)GetPSObjectProperty(mailbox, "OWAEnabled");
                info.EnableMAPI       = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled");
                info.EnablePOP        = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
                info.EnableIMAP       = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");

                //Statistics
                cmd = new Command("Get-MailboxStatistics");
                cmd.Parameters.Add("Identity", accountName);
                result = ExecuteShellCommand(runSpace, cmd);
                if (result.Count > 0)
                {
                    PSObject statistics = result[0];
                    Unlimited <ByteQuantifiedSize> totalItemSize =
                        (Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize");
                    info.TotalSizeMB = ConvertUnlimitedToMB(totalItemSize);
                    uint?itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount");
                    info.TotalItems = ConvertNullableToInt32(itemCount);
                    DateTime?lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime");;
                    DateTime?lastLogonTime  = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime");;
                    info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime);
                    info.LastLogon  = ConvertNullableToDateTime(lastLogonTime);
                }
                else
                {
                    info.TotalSizeMB = 0;
                    info.TotalItems  = 0;
                    info.LastLogoff  = DateTime.MinValue;
                    info.LastLogon   = DateTime.MinValue;
                }

                //domain
                info.Domain = GetNETBIOSDomainName();
            }
            finally
            {
                CloseRunspace(runSpace);
            }
            ExchangeLog.LogEnd("GetMailboxAdvancedSettingsInternal");
            return(info);
        }
コード例 #11
0
 internal ExpiredSubscriptionItemEnumerator(IFolder folder, uint expirationInHours, Unlimited <uint> resultSize) : base(folder, resultSize)
 {
     this.expirationInHours = expirationInHours;
 }
コード例 #12
0
 internal int ConvertUnlimitedToInt32(Unlimited<Int32> value)
 {
     int ret = 0;
     if (value.IsUnlimited)
     {
         ret = -1;
     }
     else
     {
         ret = value.Value;
     }
     return ret;
 }
コード例 #13
0
        protected void RenderColumn(TextWriter writer, ColumnId columnId, int itemIndex, bool isBold, bool openForCompose)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (itemIndex < 0 || itemIndex >= this.dataSource.RangeCount)
            {
                throw new ArgumentOutOfRangeException("itemIndex", itemIndex.ToString());
            }
            Column column = ListViewColumns.GetColumn(columnId);

            switch (columnId)
            {
            case ColumnId.MailIcon:
                if (!this.RenderIcon(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.From:
            case ColumnId.To:
            {
                string itemPropertyString = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (itemPropertyString.Length != 0)
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString, 16);
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Subject:
            {
                writer.Write("<h1");
                if (isBold)
                {
                    writer.Write(" class=\"bld\"");
                }
                writer.Write(">");
                writer.Write("<a href=\"#\"");
                this.RenderFolderNameTooltip(writer, itemIndex);
                writer.Write(" onClick=\"onClkRdMsg(this, '");
                string s = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                Utilities.HtmlEncode(Utilities.JavascriptEncode(s), writer);
                writer.Write("', {0}, {1});\">", itemIndex, openForCompose ? 1 : 0);
                string itemPropertyString2 = this.dataSource.GetItemPropertyString(itemIndex, column[0]);
                if (string.IsNullOrEmpty(itemPropertyString2.Trim()))
                {
                    writer.Write(LocalizedStrings.GetHtmlEncoded(730745110));
                }
                else
                {
                    Utilities.CropAndRenderText(writer, itemPropertyString2, 32);
                }
                writer.Write("</a></h1>");
                goto IL_857;
            }

            case ColumnId.Department:
            case ColumnId.ContactIcon:
            case ColumnId.BusinessPhone:
            case ColumnId.BusinessFax:
            case ColumnId.MobilePhone:
            case ColumnId.HomePhone:
                goto IL_74A;

            case ColumnId.HasAttachment:
            {
                bool   hasAttachments = false;
                object itemProperty   = this.dataSource.GetItemProperty(itemIndex, ItemSchema.HasAttachment);
                if (itemProperty is bool)
                {
                    hasAttachments = (bool)itemProperty;
                }
                if (!ListViewContentsRenderingUtilities.RenderHasAttachments(writer, this.userContext, hasAttachments))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Importance:
            {
                Importance importance    = Importance.Normal;
                object     itemProperty2 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Importance);
                if (itemProperty2 is Importance || itemProperty2 is int)
                {
                    importance = (Importance)itemProperty2;
                }
                if (!ListViewContentsRenderingUtilities.RenderImportance(writer, this.UserContext, importance))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.DeliveryTime:
            {
                ExDateTime itemPropertyExDateTime = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.ReceivedTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.SentTime:
            {
                ExDateTime itemPropertyExDateTime2 = this.dataSource.GetItemPropertyExDateTime(itemIndex, ItemSchema.SentTime);
                if (!this.RenderDate(writer, itemPropertyExDateTime2))
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            case ColumnId.Size:
            {
                int    num           = 0;
                object itemProperty3 = this.dataSource.GetItemProperty(itemIndex, ItemSchema.Size);
                if (itemProperty3 is int)
                {
                    num = (int)itemProperty3;
                }
                Utilities.RenderSizeWithUnits(writer, (long)num, true);
                goto IL_857;
            }

            case ColumnId.FileAs:
                break;

            case ColumnId.Title:
            case ColumnId.CompanyName:
                goto IL_5B5;

            case ColumnId.PhoneNumbers:
                if (!this.RenderPhoneNumberColumn(writer, itemIndex))
                {
                    goto IL_857;
                }
                goto IL_857;

            case ColumnId.EmailAddresses:
            {
                Participant[] array = new Participant[3];
                bool          flag  = false;
                array[0] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email1) as Participant);
                array[1] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email2) as Participant);
                array[2] = (this.dataSource.GetItemProperty(itemIndex, ContactSchema.Email3) as Participant);
                foreach (Participant participant in array)
                {
                    if (participant != null && !string.IsNullOrEmpty(participant.EmailAddress))
                    {
                        string text  = null;
                        string text2 = null;
                        ContactUtilities.GetParticipantEmailAddress(participant, out text, out text2);
                        Utilities.CropAndRenderText(writer, text, 24);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    goto IL_857;
                }
                goto IL_857;
            }

            default:
            {
                switch (columnId)
                {
                case ColumnId.CheckBox:
                {
                    VersionedId itemPropertyVersionedId = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                    ListViewContentsRenderingUtilities.RenderCheckBox(writer, itemPropertyVersionedId.ObjectId.ToBase64String());
                    string itemClass = this.dataSource.GetItemProperty(itemIndex, StoreObjectSchema.ItemClass) as string;
                    if (ObjectClass.IsMeetingRequest(itemClass) || ObjectClass.IsMeetingCancellation(itemClass))
                    {
                        if (this.meetingMessageIdStringBuilder.Length > 0)
                        {
                            this.meetingMessageIdStringBuilder.Append(",");
                        }
                        this.meetingMessageIdStringBuilder.Append(itemPropertyVersionedId.ObjectId.ToBase64String());
                        goto IL_857;
                    }
                    goto IL_857;
                }

                case ColumnId.CheckBoxContact:
                case ColumnId.CheckBoxAD:
                {
                    string arg;
                    if (columnId == ColumnId.CheckBoxAD)
                    {
                        arg = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                    }
                    else
                    {
                        VersionedId itemPropertyVersionedId2 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                        arg = itemPropertyVersionedId2.ObjectId.ToBase64String();
                    }
                    writer.Write("<input type=\"checkbox\" name=\"chkRcpt\" value=\"{0}\"", arg);
                    writer.Write(" onClick=\"onClkRChkBx(this);\">");
                    goto IL_857;
                }

                case ColumnId.ADIcon:
                case ColumnId.BusinessFaxAD:
                case ColumnId.BusinessPhoneAD:
                case ColumnId.DepartmentAD:
                    goto IL_74A;

                case ColumnId.AliasAD:
                    break;

                case ColumnId.CompanyAD:
                    goto IL_5B5;

                case ColumnId.DisplayNameAD:
                    goto IL_383;

                default:
                    switch (columnId)
                    {
                    case ColumnId.PhoneAD:
                        break;

                    case ColumnId.TitleAD:
                        goto IL_5B5;

                    default:
                        goto IL_74A;
                    }
                    break;
                }
                string text3 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;
                if (!string.IsNullOrEmpty(text3))
                {
                    Utilities.CropAndRenderText(writer, text3, 24);
                    goto IL_857;
                }
                goto IL_857;
            }
            }
IL_383:
            StringBuilder stringBuilder = new StringBuilder();
            object obj;
            int    num2;

            if (columnId == ColumnId.DisplayNameAD)
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ADRecipientSchema.DisplayName) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                obj  = Utilities.GetBase64StringFromGuid((Guid)this.dataSource.GetItemProperty(itemIndex, ADObjectSchema.Guid));
                num2 = (isBold ? 2 : 1);
            }
            else
            {
                string value = this.dataSource.GetItemProperty(itemIndex, ContactBaseSchema.FileAs) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    stringBuilder.Append(value);
                }
                bool flag2 = (columnId == ColumnId.DisplayNameAD) ? this.userContext.IsPhoneticNamesEnabled : Utilities.IsJapanese;
                if (flag2)
                {
                    string value2 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiFirstName) as string;
                    string value3 = this.dataSource.GetItemProperty(itemIndex, ContactSchema.YomiLastName) as string;
                    bool   flag3  = false;
                    if (stringBuilder.Length > 0 && (!string.IsNullOrEmpty(value3) || !string.IsNullOrEmpty(value2)))
                    {
                        stringBuilder.Append(" (");
                        flag3 = true;
                    }
                    if (!string.IsNullOrEmpty(value3))
                    {
                        stringBuilder.Append(value3);
                        if (!string.IsNullOrEmpty(value2))
                        {
                            stringBuilder.Append(" ");
                        }
                    }
                    if (!string.IsNullOrEmpty(value2))
                    {
                        stringBuilder.Append(value2);
                    }
                    if (flag3)
                    {
                        stringBuilder.Append(")");
                    }
                }
                VersionedId itemPropertyVersionedId3 = this.dataSource.GetItemPropertyVersionedId(itemIndex, ItemSchema.Id);
                obj  = itemPropertyVersionedId3.ObjectId.ToBase64String();
                num2 = (isBold ? 4 : 3);
            }
            if (Utilities.WhiteSpaceOnlyOrNullEmpty(stringBuilder.ToString()))
            {
                stringBuilder.Append(LocalizedStrings.GetNonEncoded(-808148510));
            }
            writer.Write("<h1");
            if (isBold)
            {
                writer.Write(" class=\"bld\"");
            }
            writer.Write("><a href=\"#\" id=\"{0}\"", obj.ToString());
            if (isBold)
            {
                writer.Write(" class=\"lvwdl\"");
            }
            this.RenderFolderNameTooltip(writer, itemIndex);
            writer.Write(" onClick=\"return onClkRcpt(this, {0});\">", num2);
            if (isBold)
            {
                ListViewContentsRenderingUtilities.RenderItemIcon(writer, this.userContext, "IPM.DistList");
            }
            Utilities.CropAndRenderText(writer, stringBuilder.ToString(), 32);
            writer.Write("</a></h1>");
            goto IL_857;
IL_5B5:
            string text4 = this.dataSource.GetItemProperty(itemIndex, column[0]) as string;

            if (!string.IsNullOrEmpty(text4))
            {
                Utilities.CropAndRenderText(writer, text4, 16);
                goto IL_857;
            }
            goto IL_857;
IL_74A:
            object itemProperty4 = this.dataSource.GetItemProperty(itemIndex, column[0]);
            string text5 = itemProperty4 as string;

            if (itemProperty4 is ExDateTime)
            {
                writer.Write(((ExDateTime)itemProperty4).ToString());
            }
            else if (itemProperty4 is DateTime)
            {
                ExDateTime exDateTime = new ExDateTime(this.userContext.TimeZone, (DateTime)itemProperty4);
                writer.Write(exDateTime.ToString());
            }
            else if (text5 != null)
            {
                if (text5.Length != 0)
                {
                    Utilities.HtmlEncode(text5, writer);
                }
            }
            else if (itemProperty4 is int)
            {
                Utilities.HtmlEncode(((int)itemProperty4).ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
            }
            else if (itemProperty4 is Unlimited <int> )
            {
                Unlimited <int> unlimited = (Unlimited <int>)itemProperty4;
                if (!unlimited.IsUnlimited)
                {
                    Utilities.HtmlEncode(unlimited.Value.ToString(CultureInfo.CurrentCulture.NumberFormat), writer);
                }
            }
            else if (!(itemProperty4 is PropertyError))
            {
            }
IL_857:
            writer.Write("&nbsp;");
        }
コード例 #14
0
        internal override Command.ExecutionState ExecuteCommand()
        {
            string          attachmentName  = this.AttachmentName;
            string          value           = string.Empty;
            FolderSyncState folderSyncState = null;

            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "GetAttachmentCommand.Execute(). AttachmentName: '{0}'", attachmentName);
            try
            {
                int incBy = 0;
                if (base.Request.ContentType != null && !string.Equals(base.Request.ContentType, "message/rfc822", StringComparison.OrdinalIgnoreCase))
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidContentType");
                    throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.First140Error, null, false);
                }
                int           num           = attachmentName.IndexOf(':');
                ItemIdMapping itemIdMapping = null;
                if (num != -1 && num != attachmentName.LastIndexOf(':'))
                {
                    folderSyncState = base.SyncStateStorage.GetFolderSyncState(new MailboxSyncProviderFactory(base.MailboxSession), attachmentName.Substring(0, num));
                    if (folderSyncState == null)
                    {
                        throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentName));
                    }
                    itemIdMapping = (ItemIdMapping)folderSyncState[CustomStateDatumType.IdMapping];
                    if (itemIdMapping == null)
                    {
                        throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentName));
                    }
                }
                PolicyData policyData = ADNotificationManager.GetPolicyData(base.User);
                if (policyData != null && !policyData.AttachmentsEnabled)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentsNotEnabledGetAttCmd");
                    throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false);
                }
                Unlimited <ByteQuantifiedSize> maxAttachmentSize = (policyData != null) ? policyData.MaxAttachmentSize : Unlimited <ByteQuantifiedSize> .UnlimitedValue;
                value = AttachmentHelper.GetAttachment(base.MailboxSession, attachmentName, base.OutputStream, maxAttachmentSize, itemIdMapping, out incBy);
                base.ProtocolLogger.IncrementValue(ProtocolLoggerData.Attachments);
                base.ProtocolLogger.IncrementValueBy(ProtocolLoggerData.AttachmentBytes, incBy);
            }
            catch (FormatException innerException)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidAttachmentName");
                AirSyncPermanentException ex = new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException, false);
                throw ex;
            }
            catch (ObjectNotFoundException innerException2)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentNotFound");
                AirSyncPermanentException ex2 = new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.None, innerException2, false);
                throw ex2;
            }
            catch (IOException innerException3)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "IOException");
                throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.None, innerException3, false);
            }
            catch (DataTooLargeException innerException4)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentIsTooLarge");
                PolicyData policyData2 = ADNotificationManager.GetPolicyData(base.User);
                if (policyData2 != null)
                {
                    policyData2.MaxAttachmentSize.ToString();
                }
                else
                {
                    GlobalSettings.MaxDocumentDataSize.ToString(CultureInfo.InvariantCulture);
                }
                throw new AirSyncPermanentException(HttpStatusCode.RequestEntityTooLarge, StatusCode.AttachmentIsTooLarge, innerException4, false);
            }
            finally
            {
                if (folderSyncState != null)
                {
                    folderSyncState.Dispose();
                    folderSyncState = null;
                }
            }
            base.Context.Response.AppendHeader("Content-Type", value);
            return(Command.ExecutionState.Complete);
        }
コード例 #15
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            if (!dataRow["SearchAllMailboxes"].IsNullValue() && dataRow["SearchAllMailboxes"].IsTrue())
            {
                dataRow["SourceMailboxes"] = null;
                list.Add("SourceMailboxes");
            }
            if (!dataRow["SearchAllPublicFolders"].IsNullValue() && dataRow["SearchAllPublicFolders"].IsTrue())
            {
                dataRow["PublicFolderSources"] = null;
                list.Add("PublicFolderSources");
                dataRow["AllPublicFolderSources"] = true;
                list.Add("AllPublicFolderSources");
            }
            if (!dataRow["HoldIndefinitely"].IsNullValue() && dataRow["HoldIndefinitely"].IsTrue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .UnlimitedValue;
                list.Add("ItemHoldPeriod");
            }
            else if (!dataRow["ItemHoldPeriodDays"].IsNullValue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .Parse((string)dataRow["ItemHoldPeriodDays"]);

                list.Add("ItemHoldPeriod");
            }
            if (!dataRow["StartDateEnabled"].IsNullValue())
            {
                if (dataRow["StartDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
                }
                else
                {
                    dataRow["StartDate"] = null;
                    list.Add("StartDate");
                }
            }
            else if (!dataRow["SearchStartDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
            }
            if (!dataRow["EndDateEnabled"].IsNullValue())
            {
                if (dataRow["EndDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
                }
                else
                {
                    dataRow["EndDate"] = null;
                    list.Add("EndDate");
                }
            }
            else if (!dataRow["SearchEndDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
            }
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "SenderList", "Senders");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "RecipientList", "Recipients");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "MessageTypeList", "MessageTypes");
            if (!dataRow["SearchContent"].IsNullValue() && dataRow["SearchContent"].IsFalse())
            {
                dataRow["SearchQuery"] = DBNull.Value;
                list.Add("SearchQuery");
                dataRow["Senders"] = DBNull.Value;
                list.Add("Senders");
                dataRow["Recipients"] = DBNull.Value;
                list.Add("Recipients");
                dataRow["MessageTypes"] = DBNull.Value;
                list.Add("MessageTypes");
                dataRow["StartDate"] = DBNull.Value;
                list.Add("StartDate");
                dataRow["EndDate"] = DBNull.Value;
                list.Add("EndDate");
            }
            if (RbacPrincipal.Current.IsInRole("Set-MailboxSearch?EstimateOnly&ExcludeDuplicateMessages&LogLevel"))
            {
                dataRow["EstimateOnly"] = true;
                list.Add("EstimateOnly");
                dataRow["ExcludeDuplicateMessages"] = false;
                list.Add("ExcludeDuplicateMessages");
                dataRow["LogLevel"] = LoggingLevel.Suppress;
                list.Add("LogLevel");
            }
            store.SetModifiedColumns(list);
        }
コード例 #16
0
        internal static string GetAttachment(MailboxSession mailboxSession, StoreObjectId itemId, string attachmentId, Stream outStream, int offset, int count, Unlimited <ByteQuantifiedSize> maxAttachmentSize, bool rightsManagementSupport, out int total)
        {
            string result;

            using (Item item = Item.Bind(mailboxSession, itemId))
            {
                if ("DRMLicense".Equals(attachmentId, StringComparison.OrdinalIgnoreCase))
                {
                    total  = AttachmentHelper.WriteDrmLicenseToStream(item, outStream, offset, count, maxAttachmentSize);
                    result = "application/x-microsoft-rpmsg-message-license";
                }
                else
                {
                    if (rightsManagementSupport)
                    {
                        Command.CurrentCommand.DecodeIrmMessage(item, true);
                    }
                    Attachment attachment = null;
                    try
                    {
                        AttachmentCollection attachmentCollection;
                        if (BodyConversionUtilities.IsMessageRestrictedAndDecoded(item))
                        {
                            attachmentCollection = ((RightsManagedMessageItem)item).ProtectedAttachmentCollection;
                        }
                        else
                        {
                            attachmentCollection = item.AttachmentCollection;
                        }
                        if (attachmentId.Length > 8)
                        {
                            AttachmentId attachmentId2 = EntitySyncItemId.GetAttachmentId(attachmentId);
                            if (attachmentId2 != null)
                            {
                                attachment = attachmentCollection.Open(attachmentId2);
                            }
                        }
                        if (attachment == null)
                        {
                            int num;
                            if (!int.TryParse(attachmentId, NumberStyles.None, CultureInfo.InvariantCulture, out num) || num < 0)
                            {
                                throw new FormatException("Invalid Attachment Index format: " + attachmentId.ToString(CultureInfo.InvariantCulture));
                            }
                            IList <AttachmentHandle> handles = attachmentCollection.GetHandles();
                            if (num < handles.Count)
                            {
                                attachment = attachmentCollection.Open(handles[num]);
                            }
                        }
                        if (attachment == null)
                        {
                            throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId));
                        }
                        if (BodyConversionUtilities.IsMessageRestrictedAndDecoded(item) && AttachmentHelper.IsProtectedVoiceAttachment(attachment.FileName))
                        {
                            RightsManagedMessageItem rightsManagedMessageItem = item as RightsManagedMessageItem;
                            rightsManagedMessageItem.UnprotectAttachment(attachment.Id);
                            AttachmentId id = attachment.Id;
                            attachment.Dispose();
                            attachment = rightsManagedMessageItem.ProtectedAttachmentCollection.Open(id);
                        }
                        if (!maxAttachmentSize.IsUnlimited && attachment.Size > (long)maxAttachmentSize.Value.ToBytes())
                        {
                            throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
                        }
                        result = AttachmentHelper.GetAttachmentItself(attachment, outStream, offset, count, out total);
                    }
                    finally
                    {
                        if (attachment != null)
                        {
                            attachment.Dispose();
                        }
                        if (rightsManagementSupport)
                        {
                            Command.CurrentCommand.SaveLicense(item);
                        }
                    }
                }
            }
            return(result);
        }
コード例 #17
0
        private static int WriteDrmLicenseToStream(Item item, Stream outStream, int offset, int count, Unlimited <ByteQuantifiedSize> maxAttachmentSize)
        {
            object obj = item.TryGetProperty(MessageItemSchema.DRMLicense);

            byte[][] array = obj as byte[][];
            if (array == null)
            {
                throw new FormatException(string.Format(CultureInfo.InvariantCulture, "Failed to get license property for item: {0} returned: {1}", new object[]
                {
                    item.Id.ToBase64String(),
                    (obj != null) ? obj.ToString() : "null"
                }));
            }
            if (array.Length <= 0)
            {
                throw new FormatException(string.Format(CultureInfo.InvariantCulture, "Invalid license property for item: {0} length: {1}", new object[]
                {
                    item.Id.ToBase64String(),
                    array
                }));
            }
            if (!maxAttachmentSize.IsUnlimited && (long)array[0].Length > (long)maxAttachmentSize.Value.ToBytes())
            {
                throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
            }
            int result;

            using (Stream stream = new MemoryStream(array[0]))
            {
                if (stream.Length > 0L)
                {
                    if ((long)offset >= stream.Length)
                    {
                        throw new ArgumentOutOfRangeException("offset");
                    }
                    int num = (count == -1) ? ((int)stream.Length) : count;
                    if (num > GlobalSettings.MaxDocumentDataSize)
                    {
                        throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
                    }
                    StreamHelper.CopyStream(stream, outStream, offset, num);
                }
                result = (int)stream.Length;
            }
            return(result);
        }
コード例 #18
0
        private static string GetAttachmentByUrlCompName(MailboxSession mailboxSession, string attachmentId, Stream outStream, int offset, int count, Unlimited <ByteQuantifiedSize> maxAttachmentSize, out int total)
        {
            attachmentId = "/" + attachmentId;
            int    andCheckLastSlashLocation = AttachmentHelper.GetAndCheckLastSlashLocation(attachmentId, attachmentId);
            string text  = attachmentId.Substring(0, andCheckLastSlashLocation);
            string text2 = attachmentId.Substring(andCheckLastSlashLocation + 1);

            andCheckLastSlashLocation = AttachmentHelper.GetAndCheckLastSlashLocation(text, attachmentId);
            string      propertyValue = text.Substring(0, andCheckLastSlashLocation);
            StoreId     storeId       = null;
            QueryFilter seekFilter    = new ComparisonFilter(ComparisonOperator.Equal, FolderSchema.UrlName, propertyValue);

            using (Folder folder = Folder.Bind(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Root)))
            {
                using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, AirSyncUtility.XsoFilters.GetHierarchyFilter, null, AttachmentHelper.folderPropertyIds))
                {
                    if (queryResult.SeekToCondition(SeekReference.OriginBeginning, seekFilter))
                    {
                        object[][] rows = queryResult.GetRows(1);
                        storeId = (rows[0][0] as StoreId);
                    }
                }
            }
            if (storeId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId));
            }
            AirSyncDiagnostics.TraceDebug <StoreId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with parentStoreId {0}.", storeId);
            StoreId storeId2 = null;

            seekFilter = new ComparisonFilter(ComparisonOperator.Equal, FolderSchema.UrlName, text);
            using (Folder folder2 = Folder.Bind(mailboxSession, storeId))
            {
                using (QueryResult queryResult2 = folder2.ItemQuery(ItemQueryType.None, null, null, AttachmentHelper.itemPropertyIds))
                {
                    if (queryResult2.SeekToCondition(SeekReference.OriginBeginning, seekFilter))
                    {
                        object[][] rows2 = queryResult2.GetRows(1);
                        storeId2 = (rows2[0][0] as StoreId);
                    }
                }
            }
            if (storeId2 == null)
            {
                throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId));
            }
            AirSyncDiagnostics.TraceDebug <StoreId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with itemStoreId {0}.", storeId2);
            PropertyTagPropertyDefinition propertyTagPropertyDefinition = PropertyTagPropertyDefinition.CreateCustom("UrlCompName", 284360734U);
            string attachmentItself;

            using (Item item = Item.Bind(mailboxSession, storeId2))
            {
                AttachmentCollection attachmentCollection = item.AttachmentCollection;
                attachmentCollection.Load(new PropertyDefinition[]
                {
                    propertyTagPropertyDefinition
                });
                AttachmentId attachmentId2 = null;
                foreach (AttachmentHandle handle in attachmentCollection)
                {
                    using (Attachment attachment = attachmentCollection.Open(handle))
                    {
                        if (text2.Equals((string)attachment[propertyTagPropertyDefinition], StringComparison.Ordinal))
                        {
                            attachmentId2 = attachment.Id;
                            break;
                        }
                    }
                }
                if (attachmentId2 == null)
                {
                    foreach (AttachmentHandle handle2 in attachmentCollection)
                    {
                        using (Attachment attachment2 = attachmentCollection.Open(handle2))
                        {
                            string str = (string)attachment2[propertyTagPropertyDefinition];
                            if (text2.EndsWith("_" + str, StringComparison.Ordinal))
                            {
                                attachmentId2 = attachment2.Id;
                                break;
                            }
                        }
                    }
                }
                if (attachmentId2 == null)
                {
                    throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId));
                }
                AirSyncDiagnostics.TraceDebug <AttachmentId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with attachment ID {0}.", attachmentId2);
                using (Attachment attachment3 = attachmentCollection.Open(attachmentId2))
                {
                    if (!maxAttachmentSize.IsUnlimited && attachment3.Size > (long)maxAttachmentSize.Value.ToBytes())
                    {
                        throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge);
                    }
                    attachmentItself = AttachmentHelper.GetAttachmentItself(attachment3, outStream, offset, count, out total);
                }
            }
            return(attachmentItself);
        }
コード例 #19
0
        internal static string GetAttachment(MailboxSession mailboxSession, string attachmentId, Stream outStream, int offset, int count, Unlimited <ByteQuantifiedSize> maxAttachmentSize, ItemIdMapping idmapping, bool rightsManagementSupport, out int total)
        {
            string[] array = attachmentId.Split(new char[]
            {
                ':'
            });
            if (array.Length != 2 && array.Length != 3)
            {
                return(AttachmentHelper.GetAttachmentByUrlCompName(mailboxSession, attachmentId, outStream, offset, count, maxAttachmentSize, out total));
            }
            StoreObjectId itemId;
            string        text;

            if (array.Length == 2)
            {
                itemId = AttachmentHelper.GetItemId(array[0]);
                text   = array[1];
            }
            else
            {
                itemId = AttachmentHelper.GetItemId(idmapping, array[0], array[1]);
                text   = array[2];
            }
            if (itemId == null)
            {
                throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId));
            }
            AirSyncDiagnostics.TraceDebug <StoreObjectId, string>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with itemId {0} and attachmentIndex {1}.", itemId, text);
            return(AttachmentHelper.GetAttachment(mailboxSession, itemId, text, outStream, offset, count, maxAttachmentSize, rightsManagementSupport, out total));
        }
コード例 #20
0
 internal BaseAttachmentFetchProvider(MailboxSession session, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, Unlimited <ByteQuantifiedSize> maxAttachmentSize, bool attachmentsEnabled)
 {
     this.Session            = session;
     this.SyncStateStorage   = syncStateStorage;
     this.ProtocolLogger     = protocolLogger;
     this.MaxAttachmentSize  = maxAttachmentSize;
     this.AttachmentsEnabled = attachmentsEnabled;
     AirSyncCounters.NumberOfMailboxAttachmentFetches.Increment();
 }
コード例 #21
0
 public MailboxAuditLogSearchWorker(int searchTimeoutSeconds, MailboxAuditLogSearch searchCriteria, Unlimited <int> resultSize, AuditLogOpticsLogData searchStatistics)
 {
     if (searchTimeoutSeconds <= 0)
     {
         throw new ArgumentOutOfRangeException("searchTimeoutSeconds");
     }
     if (searchCriteria == null)
     {
         throw new ArgumentNullException("searchCriteria");
     }
     this.searchCriteria   = searchCriteria;
     this.searchStatistics = searchStatistics;
     if (MailboxAuditLogSearchWorker.UseFASTQuery(this.searchCriteria))
     {
         this.queryString = this.GenerateFASTSearchQueryString();
     }
     else
     {
         this.queryFilter = this.GenerateSearchQueryFilter();
     }
     this.searchTimeoutSeconds     = searchTimeoutSeconds;
     this.resultSize               = resultSize;
     this.recipientSessionInternal = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(searchCriteria.OrganizationId), 163, ".ctor", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxAuditLog\\MailboxAuditLogSearchWorker.cs");
 }
コード例 #22
0
        // Token: 0x06000E7E RID: 3710 RVA: 0x00045A0C File Offset: 0x00043C0C
        internal static object ConvertValueToStore(object originalValue)
        {
            if (originalValue == null)
            {
                return(null);
            }
            if (originalValue is Enum)
            {
                return((int)originalValue);
            }
            if (originalValue is TimeSpan)
            {
                return((int)((TimeSpan)originalValue).TotalMinutes);
            }
            if (originalValue is Uri)
            {
                return(((Uri)originalValue).ToString());
            }
            if (originalValue is ADObjectId)
            {
                return(((ADObjectId)originalValue).GetBytes());
            }
            if (originalValue is MultiValuedProperty <string> )
            {
                return(SimpleStoreValueConverter.ConvertMvpStringToStringArray((MultiValuedProperty <string>)originalValue));
            }
            if (originalValue is MultiValuedProperty <int> )
            {
                return(SimpleStoreValueConverter.ConvertMvpIntToIntArray((MultiValuedProperty <int>)originalValue));
            }
            if (originalValue is MultiValuedProperty <ADObjectId> )
            {
                return(SimpleStoreValueConverter.ConvertMvpADObjectIdToStringArray((MultiValuedProperty <ADObjectId>)originalValue));
            }
            if (originalValue is MultiValuedProperty <KeywordHit> )
            {
                return(SimpleStoreValueConverter.ConvertMvpToStringArray <KeywordHit>((MultiValuedProperty <KeywordHit>)originalValue));
            }
            if (originalValue is MultiValuedProperty <DiscoverySearchStats> )
            {
                return(SimpleStoreValueConverter.ConvertMvpToStringArray <DiscoverySearchStats>((MultiValuedProperty <DiscoverySearchStats>)originalValue));
            }
            if (originalValue is CultureInfo)
            {
                return(originalValue.ToString());
            }
            if (originalValue is ExchangeObjectVersion)
            {
                return(((ExchangeObjectVersion)originalValue).ToInt64());
            }
            if (!(originalValue is Unlimited <EnhancedTimeSpan>))
            {
                return(originalValue);
            }
            Unlimited <EnhancedTimeSpan> value = (Unlimited <EnhancedTimeSpan>)originalValue;

            if (value == Unlimited <EnhancedTimeSpan> .UnlimitedValue)
            {
                return(null);
            }
            return(value.Value.Ticks);
        }
コード例 #23
0
 internal Unlimited<int> ConvertInt32ToUnlimited(int value)
 {
     if (value == -1)
         return Unlimited<int>.UnlimitedValue;
     else
     {
         Unlimited<int> ret = new Unlimited<int>();
         ret.Value = value;
         return ret;
     }
 }
コード例 #24
0
 public MigrationMaxConcurrentIncrementalSyncsVerificationFailedException(Unlimited <int> value, Unlimited <int> maxValue, Exception innerException) : base(Strings.MigrationMaxConcurrentIncrementalSyncsVerificationFailed(value, maxValue), innerException)
 {
     this.value    = value;
     this.maxValue = maxValue;
 }
コード例 #25
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            bool          flag         = false;
            MigrationType endpointType = this.DataObject.EndpointType;

            if (endpointType <= MigrationType.ExchangeOutlookAnywhere)
            {
                if (endpointType == MigrationType.IMAP)
                {
                    this.WriteParameterErrorIfSet("Credentials");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.ExchangeOutlookAnywhere)
                {
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    goto IL_2B4;
                }
            }
            else
            {
                if (endpointType == MigrationType.ExchangeRemoteMove)
                {
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Authentication");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.PSTImport)
                {
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("RPCProxyServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Authentication");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("PublicFolderDatabaseServerLegacyDN");
                    this.WriteParameterErrorIfSet("TestMailbox", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("SourceMailboxLegacyDN", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
                if (endpointType == MigrationType.PublicFolder)
                {
                    this.WriteParameterErrorIfSet("RemoteServer");
                    this.WriteParameterErrorIfSet("ExchangeServer");
                    this.WriteParameterErrorIfSet("Port");
                    this.WriteParameterErrorIfSet("MailboxPermission");
                    this.WriteParameterErrorIfSet("Security");
                    this.WriteParameterErrorIfSet("NspiServer");
                    this.WriteParameterErrorIfSet("EmailAddress", new LocalizedString?(Strings.ErrorInvalidEndpointParameterReasonUsedForConnectionTest));
                    goto IL_2B4;
                }
            }
            base.WriteError(new InvalidEndpointTypeException(this.Identity.RawIdentity, this.DataObject.EndpointType.ToString()));
IL_2B4:
            if (base.IsFieldSet("MaxConcurrentMigrations") || base.IsFieldSet("MaxConcurrentIncrementalSyncs"))
            {
                Unlimited <int> unlimited  = base.IsFieldSet("MaxConcurrentMigrations") ? this.MaxConcurrentMigrations : this.DataObject.MaxConcurrentMigrations;
                Unlimited <int> unlimited2 = base.IsFieldSet("MaxConcurrentIncrementalSyncs") ? this.MaxConcurrentIncrementalSyncs : this.DataObject.MaxConcurrentIncrementalSyncs;
                if (unlimited2 > unlimited)
                {
                    base.WriteError(new MigrationMaxConcurrentIncrementalSyncsVerificationFailedException(unlimited2, unlimited));
                }
            }
            if (base.IsFieldSet("MaxConcurrentMigrations") && !this.MaxConcurrentMigrations.Equals(this.DataObject.MaxConcurrentMigrations))
            {
                this.DataObject.MaxConcurrentMigrations = this.MaxConcurrentMigrations;
                this.changed = true;
            }
            if (base.IsFieldSet("MaxConcurrentIncrementalSyncs") && !this.MaxConcurrentIncrementalSyncs.Equals(this.DataObject.MaxConcurrentIncrementalSyncs))
            {
                this.DataObject.MaxConcurrentIncrementalSyncs = this.MaxConcurrentIncrementalSyncs;
                this.changed = true;
            }
            if (base.IsFieldSet("Credentials") && (this.Credentials == null || !this.Credentials.Equals(this.DataObject.Credentials)))
            {
                this.DataObject.Credentials = this.Credentials;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("MailboxPermission") && this.MailboxPermission != this.DataObject.MailboxPermission)
            {
                this.DataObject.MailboxPermission = this.MailboxPermission;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("ExchangeServer") && !this.ExchangeServer.Equals(this.DataObject.ExchangeServer))
            {
                this.DataObject.ExchangeServer = this.ExchangeServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("RPCProxyServer") && !this.RpcProxyServer.Equals(this.DataObject.RpcProxyServer))
            {
                this.DataObject.RpcProxyServer = this.RpcProxyServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("Port") && !this.Port.Equals(this.DataObject.Port))
            {
                this.DataObject.Port = new int?(this.Port);
                this.changed         = true;
                flag = true;
            }
            if (base.IsFieldSet("Authentication") && !this.Authentication.Equals(this.DataObject.Authentication))
            {
                this.DataObject.Authentication = new AuthenticationMethod?(this.Authentication);
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("Security") && !this.Security.Equals(this.DataObject.Security))
            {
                this.DataObject.Security = new IMAPSecurityMechanism?(this.Security);
                this.changed             = true;
                flag = true;
            }
            if (base.IsFieldSet("RemoteServer") && !this.RemoteServer.Equals(this.DataObject.RemoteServer))
            {
                this.DataObject.RemoteServer = this.RemoteServer;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("NspiServer") && !this.NspiServer.Equals(this.DataObject.NspiServer))
            {
                this.DataObject.NspiServer = this.NspiServer;
                this.changed = true;
                flag         = true;
            }
            if (this.DataObject.EndpointType == MigrationType.PublicFolder && base.IsFieldSet("SourceMailboxLegacyDN") && !this.SourceMailboxLegacyDN.Equals(this.DataObject.SourceMailboxLegacyDN))
            {
                if (!LegacyDN.IsValidLegacyDN(this.SourceMailboxLegacyDN))
                {
                    base.WriteError(new InvalidLegacyExchangeDnValueException("SourceMailboxLegacyDN"));
                }
                this.DataObject.SourceMailboxLegacyDN = this.SourceMailboxLegacyDN;
                this.changed = true;
                flag         = true;
            }
            if (base.IsFieldSet("PublicFolderDatabaseServerLegacyDN") && !this.PublicFolderDatabaseServerLegacyDN.Equals(this.DataObject.PublicFolderDatabaseServerLegacyDN))
            {
                if (!LegacyDN.IsValidLegacyDN(this.PublicFolderDatabaseServerLegacyDN))
                {
                    base.WriteError(new InvalidLegacyExchangeDnValueException("PublicFolderDatabaseServerLegacyDN"));
                }
                this.DataObject.PublicFolderDatabaseServerLegacyDN = this.PublicFolderDatabaseServerLegacyDN;
                this.changed = true;
                flag         = true;
            }
            if (flag)
            {
                this.DataObject.LastModifiedTime = (DateTime)ExDateTime.UtcNow;
            }
            if (!this.SkipVerification)
            {
                MigrationEndpointBase migrationEndpointBase = MigrationEndpointBase.CreateFrom(this.DataObject);
                migrationEndpointBase.VerifyConnectivity();
                if (this.DataObject.EndpointType == MigrationType.ExchangeOutlookAnywhere)
                {
                    ExchangeOutlookAnywhereEndpoint exchangeOutlookAnywhereEndpoint = (ExchangeOutlookAnywhereEndpoint)migrationEndpointBase;
                    if (!string.IsNullOrEmpty(this.SourceMailboxLegacyDN) || this.EmailAddress != SmtpAddress.Empty || !string.IsNullOrEmpty(exchangeOutlookAnywhereEndpoint.EmailAddress))
                    {
                        MailboxData targetMailbox = TestMigrationServerAvailability.DiscoverTestMailbox(this.TestMailbox, ((MigrationADProvider)this.DataProvider.ADProvider).RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                        string      text          = (string)this.EmailAddress;
                        if (string.IsNullOrEmpty(text))
                        {
                            text = exchangeOutlookAnywhereEndpoint.EmailAddress;
                        }
                        TestMigrationServerAvailability.VerifyExchangeOutlookAnywhereConnection(this.DataProvider, exchangeOutlookAnywhereEndpoint, text, this.SourceMailboxLegacyDN, targetMailbox, false);
                        return;
                    }
                }
                else if (this.DataObject.EndpointType == MigrationType.PublicFolder)
                {
                    MailboxData mailboxData = TestMigrationServerAvailability.DiscoverPublicFolderTestMailbox(this.TestMailbox, this.ConfigurationSession, ((MigrationADProvider)this.DataProvider.ADProvider).RecipientSession, base.ServerSettings, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
                    TestMigrationServerAvailability.VerifyPublicFolderConnection(this.DataProvider, (PublicFolderEndpoint)migrationEndpointBase, this.SourceMailboxLegacyDN, this.PublicFolderDatabaseServerLegacyDN, mailboxData);
                }
            }
        }
コード例 #26
0
 public SubscriptionItemEnumerator(IFolder folder, Unlimited <uint> resultSize) : base(folder, resultSize)
 {
 }
コード例 #27
0
        internal override ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id)
        {
            ExchangeLog.LogStart("GetMailboxStatisticsInternal");
            ExchangeLog.DebugInfo("Account: {0}", id);

            ExchangeMailboxStatistics info = new ExchangeMailboxStatistics();
            Runspace runSpace = null;

            try
            {
                runSpace = OpenRunspace();

                Collection <PSObject> result = GetMailboxObject(runSpace, id);
                PSObject mailbox             = result[0];

                string         dn    = GetResultObjectDN(result);
                string         path  = AddADPrefix(dn);
                DirectoryEntry entry = GetADObject(path);
                info.Enabled = !(bool)entry.InvokeGet("AccountDisabled");
                info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");

                info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
                SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress");
                if (smtpAddress != null)
                {
                    info.PrimaryEmailAddress = smtpAddress.ToString();
                }

                info.MaxSize = ConvertUnlimitedToBytes((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
                info.LitigationHoldMaxSize = ConvertUnlimitedToBytes((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));

                DateTime?whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated");
                info.AccountCreated = ConvertNullableToDateTime(whenCreated);
                //Client Access
                Command cmd = new Command("Get-CASMailbox");
                cmd.Parameters.Add("Identity", id);
                result  = ExecuteShellCommand(runSpace, cmd);
                mailbox = result[0];

                info.ActiveSyncEnabled = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled");
                info.OWAEnabled        = (bool)GetPSObjectProperty(mailbox, "OWAEnabled");
                info.MAPIEnabled       = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled");
                info.POPEnabled        = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
                info.IMAPEnabled       = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");

                //Statistics
                cmd = new Command("Get-MailboxStatistics");
                cmd.Parameters.Add("Identity", id);
                result = ExecuteShellCommand(runSpace, cmd);
                if (result.Count > 0)
                {
                    PSObject statistics = result[0];
                    Unlimited <ByteQuantifiedSize> totalItemSize = (Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize");
                    info.TotalSize = ConvertUnlimitedToBytes(totalItemSize);

                    uint?itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount");
                    info.TotalItems = ConvertNullableToInt32(itemCount);

                    DateTime?lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime");
                    DateTime?lastLogonTime  = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime");
                    info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime);
                    info.LastLogon  = ConvertNullableToDateTime(lastLogonTime);
                }
                else
                {
                    info.TotalSize  = 0;
                    info.TotalItems = 0;
                    info.LastLogoff = DateTime.MinValue;
                    info.LastLogon  = DateTime.MinValue;
                }

                if (info.LitigationHoldEnabled)
                {
                    cmd = new Command("Get-MailboxFolderStatistics");
                    cmd.Parameters.Add("FolderScope", "RecoverableItems");
                    cmd.Parameters.Add("Identity", id);
                    result = ExecuteShellCommand(runSpace, cmd);
                    if (result.Count > 0)
                    {
                        PSObject           statistics    = result[0];
                        ByteQuantifiedSize totalItemSize = (ByteQuantifiedSize)GetPSObjectProperty(statistics, "FolderAndSubfolderSize");
                        info.LitigationHoldTotalSize = (totalItemSize == null) ? 0 : ConvertUnlimitedToBytes(totalItemSize);

                        Int32 itemCount = (Int32)GetPSObjectProperty(statistics, "ItemsInFolder");
                        info.LitigationHoldTotalItems = (itemCount == 0) ? 0 : itemCount;
                    }
                }
                else
                {
                    info.LitigationHoldTotalSize  = 0;
                    info.LitigationHoldTotalItems = 0;
                }
            }
            finally
            {
                CloseRunspace(runSpace);
            }
            ExchangeLog.LogEnd("GetMailboxStatisticsInternal");
            return(info);
        }
コード例 #28
0
        private static bool RevertBackupThrottlingSettings(ThrottlingPolicy policy, out string backupThrottling)
        {
            bool flag = false;

            backupThrottling = (policy[ThrottlingPolicySchema.PowerShellThrottlingBackup] as string);
            if (!string.IsNullOrEmpty(backupThrottling))
            {
                using (StringReader stringReader = new StringReader(backupThrottling))
                {
                    while (stringReader.Peek() >= 0)
                    {
                        string[] array = stringReader.ReadLine().Split(new char[]
                        {
                            ':'
                        });
                        Unlimited <uint> value;
                        if (array.Length == 2 && PowerShellThrottlingPolicyUpdater.PowerShellThrottlingPolicyPropertyDictionary.ContainsKey(array[0]) && Unlimited <uint> .TryParse(array[1], out value))
                        {
                            policy[PowerShellThrottlingPolicyUpdater.PowerShellThrottlingPolicyPropertyDictionary[array[0]]] = new Unlimited <uint>?(value);
                            flag = true;
                        }
                    }
                }
                if (flag)
                {
                    policy[ThrottlingPolicySchema.PowerShellThrottlingBackup] = string.Empty;
                }
            }
            return(flag);
        }
コード例 #29
0
        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);
        }
コード例 #30
0
 public MigrationSlotCapacityExceededException(Unlimited <int> availableCapacity, int requestedCapacity, Exception innerException) : base(Strings.ErrorMigrationSlotCapacityExceeded(availableCapacity, requestedCapacity), innerException)
 {
     this.availableCapacity = availableCapacity;
     this.requestedCapacity = requestedCapacity;
 }
コード例 #31
0
 // Token: 0x06000C3B RID: 3131 RVA: 0x00040183 File Offset: 0x0003E383
 internal MailboxAttachmentFetchProvider(MailboxSession session, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, Unlimited <ByteQuantifiedSize> maxAttachmentSize, bool attachmentsEnabled) : base(session, syncStateStorage, protocolLogger, maxAttachmentSize, attachmentsEnabled)
 {
 }
コード例 #32
0
 private void UpdateSettings(Unlimited <uint> maxBalance, Unlimited <uint> rechargeRate, Unlimited <uint> minBalance)
 {
     if (rechargeRate == 0U)
     {
         throw new ArgumentOutOfRangeException("rechargeRate", rechargeRate, "rechargeRate must be greater than zero.");
     }
     lock (this.instanceLock)
     {
         this.Update(default(TimeSpan));
         this.MaximumBalance   = (int)(maxBalance.IsUnlimited ? 2147483647U : maxBalance.Value);
         this.MinimumBalance   = (int)(minBalance.IsUnlimited ? 2147483648U : (uint.MaxValue * minBalance.Value));
         this.RechargeRate     = (int)(rechargeRate.IsUnlimited ? 2147483647U : rechargeRate.Value);
         this.rechargeRateMsec = (double)this.RechargeRate / 3600000.0;
         if (!minBalance.IsUnlimited && this.balance < (float)this.MinimumBalance)
         {
             this.LockBucket();
         }
         else if (this.balance > (float)this.MaximumBalance)
         {
             this.balance = (float)this.MaximumBalance;
         }
         if (this.locked && this.balance > (float)this.MinimumBalance)
         {
             this.UnlockBucket();
         }
     }
 }