示例#1
0
        internal static TransportRulePredicate CreateFromInternalCondition <T>(Condition condition, string propertyName) where T : SizeOverPredicate, new()
        {
            if (condition.ConditionType != ConditionType.Predicate)
            {
                return(null);
            }
            PredicateCondition predicateCondition = (PredicateCondition)condition;

            if (!predicateCondition.Name.Equals("greaterThanOrEqual") || !predicateCondition.Property.Name.Equals(propertyName) || predicateCondition.Value.RawValues.Count != 1)
            {
                return(null);
            }
            ulong num;

            if (!ulong.TryParse(predicateCondition.Value.RawValues[0], out num))
            {
                return(null);
            }
            T t = Activator.CreateInstance <T>();

            if (num == 0UL)
            {
                t.Size = ByteQuantifiedSize.FromKB(0UL);
            }
            else
            {
                t.Size = ByteQuantifiedSize.FromBytes(num);
            }
            return(t);
        }
示例#2
0
 internal DatabaseSeedStatus(int percent, long kbytesRead, long kbytesWritten, float kbytesReadPerSec, float kbytesWrittenPerSec)
 {
     this.ProgressPercentage = percent;
     this.BytesRead          = ByteQuantifiedSize.FromKB((ulong)kbytesRead);
     this.BytesWritten       = ByteQuantifiedSize.FromKB((ulong)kbytesWritten);
     this.BytesReadPerSec    = ByteQuantifiedSize.FromKB((ulong)kbytesReadPerSec);
     this.BytesWrittenPerSec = ByteQuantifiedSize.FromKB((ulong)kbytesWrittenPerSec);
 }
示例#3
0
 internal override void StampPersistableDefaultValues()
 {
     if (!base.IsModified(PublicFolderDatabaseSchema.MaxItemSize))
     {
         this.MaxItemSize = new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(10240UL));
     }
     if (!base.IsModified(PublicFolderDatabaseSchema.ProhibitPostQuota))
     {
         this.ProhibitPostQuota = new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromGB(2UL));
     }
     base.StampPersistableDefaultValues();
 }
示例#4
0
 private void ApplyDefaultTransportSettings(IConfigurationSession session)
 {
     TransportConfigContainer[] array = session.Find <TransportConfigContainer>(null, QueryScope.SubTree, null, null, 1);
     if (array == null || array.Length == 0)
     {
         return;
     }
     array[0].MaxRecipientEnvelopeLimit = 500;
     array[0].MaxReceiveSize            = ByteQuantifiedSize.FromKB(10240UL);
     array[0].MaxSendSize = ByteQuantifiedSize.FromKB(10240UL);
     session.Save(array[0]);
 }
示例#5
0
 internal static UnifiedAuditLoggerSettings Load()
 {
     return(new UnifiedAuditLoggerSettings
     {
         CacheSize = ByteQuantifiedSize.FromKB(128UL),
         DirectoryPath = "D:\\ComplianceAudit\\LocalQueue",
         FlushInterval = TimeSpan.FromMilliseconds(1000.0),
         FlushToDisk = true,
         MaxAge = TimeSpan.FromDays(3.0),
         MaxDirectorySize = ByteQuantifiedSize.FromMB(5000UL),
         MaxFileSize = ByteQuantifiedSize.FromMB(4UL)
     });
 }
示例#6
0
        public virtual void ProcessPolicyParams(ActiveSyncMailboxPolicyObject originalPolicy)
        {
            bool   flag  = originalPolicy == null;
            bool   flag2 = this.DevicePasswordEnabled ?? (!flag && originalPolicy.DevicePasswordEnabled);
            object value;

            if (this.CheckAndParseParams <EnhancedTimeSpan>(true, this.IsDevicePolicyRefreshIntervalSet, flag ? null : new bool?(originalPolicy.IsDevicePolicyRefreshIntervalSet), this.DevicePolicyRefreshInterval, (string x) => EnhancedTimeSpan.FromHours(double.Parse(x)), out value))
            {
                base["DevicePolicyRefreshInterval"] = value;
            }
            if (this.CheckAndParseParams <int>(true, this.IsMaxEmailBodyTruncationSizeSet, flag ? null : new bool?(originalPolicy.IsMaxEmailBodyTruncationSizeSet), this.MaxEmailBodyTruncationSize, (string x) => int.Parse(x), out value))
            {
                base["MaxEmailBodyTruncationSize"] = value;
            }
            if (this.CheckAndParseParams <ByteQuantifiedSize>(true, this.IsMaxAttachmentSizeSet, flag ? null : new bool?(originalPolicy.IsMaxAttachmentSizeSet), this.MaxAttachmentSize, (string x) => ByteQuantifiedSize.FromKB(ulong.Parse(x)), out value))
            {
                base["MaxAttachmentSize"] = value;
            }
            if (flag2)
            {
                if (this.AlphanumericDevicePasswordRequired == true || (!flag && this.AlphanumericDevicePasswordRequired == null && originalPolicy.AlphanumericDevicePasswordRequired))
                {
                    int?minDevicePasswordComplexCharacters = this.MinDevicePasswordComplexCharacters;
                    int?num = (minDevicePasswordComplexCharacters != null) ? new int?(minDevicePasswordComplexCharacters.GetValueOrDefault()) : ((flag || originalPolicy.AlphanumericDevicePasswordRequired) ? this.MinDevicePasswordComplexCharacters : new int?(3));
                    if (num != null)
                    {
                        base["MinDevicePasswordComplexCharacters"] = num;
                    }
                }
                if (this.CheckAndParseParams <int>(false, this.IsMinDevicePasswordLengthSet, flag ? null : new bool?(originalPolicy.IsMinDevicePasswordLengthSet), this.MinDevicePasswordLength ?? ((flag || originalPolicy.IsMinDevicePasswordLengthSet) ? this.MinDevicePasswordLength : "4"), (string x) => int.Parse(x), out value))
                {
                    base["MinDevicePasswordLength"] = value;
                }
                if (this.CheckAndParseParams <int>(false, this.IsMinDevicePasswordLengthSet, flag ? null : new bool?(originalPolicy.IsMinDevicePasswordLengthSet), this.MinDevicePasswordLength ?? ((flag || originalPolicy.IsMinDevicePasswordLengthSet) ? this.MinDevicePasswordLength : "4"), (string x) => int.Parse(x), out value))
                {
                    base["MinDevicePasswordLength"] = value;
                }
                if (this.CheckAndParseParams <int>(true, this.IsMaxDevicePasswordFailedAttemptsSet, flag ? null : new bool?(originalPolicy.IsMaxDevicePasswordFailedAttemptsSet), this.MaxDevicePasswordFailedAttempts ?? ((flag || originalPolicy.IsMaxDevicePasswordFailedAttemptsSet) ? this.MaxDevicePasswordFailedAttempts : "8"), (string x) => int.Parse(x), out value))
                {
                    base["MaxDevicePasswordFailedAttempts"] = value;
                }
                if (this.CheckAndParseParams <EnhancedTimeSpan>(true, this.IsDevicePasswordExpirationSet, flag ? null : new bool?(originalPolicy.IsDevicePasswordExpirationSet), this.DevicePasswordExpiration ?? ((flag || originalPolicy.IsDevicePasswordExpirationSet) ? this.DevicePasswordExpiration : "90"), (string x) => EnhancedTimeSpan.FromDays(double.Parse(x)), out value))
                {
                    base["DevicePasswordExpiration"] = value;
                }
                if (this.CheckAndParseParams <EnhancedTimeSpan>(true, this.IsMaxInactivityTimeDeviceLockSet, flag ? null : new bool?(originalPolicy.IsMaxInactivityTimeDeviceLockSet), this.MaxInactivityTimeDeviceLock ?? ((flag || originalPolicy.IsMaxInactivityTimeDeviceLockSet) ? this.MaxInactivityTimeDeviceLock : "15"), (string x) => EnhancedTimeSpan.FromMinutes(double.Parse(x)), out value))
                {
                    base["MaxInactivityTimeDeviceLock"] = value;
                }
                if (this.RequireDeviceEncryption != null)
                {
                    base["RequireDeviceEncryption"] = this.RequireDeviceEncryption;
                }
                if (this.RequireStorageCardEncryption != null)
                {
                    base["RequireStorageCardEncryption"] = this.RequireStorageCardEncryption;
                }
                if (this.AllowSimpleDevicePassword != null)
                {
                    base["AllowSimpleDevicePassword"] = this.AllowSimpleDevicePassword;
                }
                if (this.AlphanumericDevicePasswordRequired != null)
                {
                    base["AlphanumericDevicePasswordRequired"] = this.AlphanumericDevicePasswordRequired;
                }
                if (this.PasswordRecoveryEnabled != null)
                {
                    base["PasswordRecoveryEnabled"] = this.PasswordRecoveryEnabled;
                }
                if (this.DevicePasswordHistory != null)
                {
                    base["DevicePasswordHistory"] = this.DevicePasswordHistory;
                }
            }
        }
示例#7
0
        internal static object MaxItemSizeGetter(IPropertyBag propertyBag)
        {
            int?num = propertyBag[PublicFolderSchema.PfMsgSizeLimit] as int?;

            if (num != null)
            {
                int value = num.Value;
                return((value < 0) ? Unlimited <ByteQuantifiedSize> .UnlimitedValue : new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)value))));
            }
            return(Unlimited <ByteQuantifiedSize> .UnlimitedValue);
        }
示例#8
0
        internal static object IssueWarningQuotaGetter(IPropertyBag propertyBag)
        {
            int?num = propertyBag[PublicFolderSchema.PfStorageQuota] as int?;

            if (num != null)
            {
                int value = num.Value;
                return((value < 0) ? Unlimited <ByteQuantifiedSize> .UnlimitedValue : new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)value))));
            }
            return(Unlimited <ByteQuantifiedSize> .UnlimitedValue);
        }
示例#9
0
 public static object ExtractNullableUnlimitedByteQuantifiedSizeFromKilobytes(PropValue value, MapiPropertyDefinition propertyDefinition)
 {
     if (typeof(Unlimited <ByteQuantifiedSize>?) == propertyDefinition.Type)
     {
         object obj = null;
         if (MapiPropValueConvertor.TryCastValueToExtract(value, typeof(long), out obj))
         {
             long num = (long)obj;
             if (0L > num)
             {
                 return(new Unlimited <ByteQuantifiedSize>?(Unlimited <ByteQuantifiedSize> .UnlimitedValue));
             }
             return(new Unlimited <ByteQuantifiedSize>?(new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)num)))));
         }
     }
     throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ConstantNa);
 }
示例#10
0
 internal override void Reset()
 {
     this.size = ByteQuantifiedSize.FromKB(0UL);
     base.Reset();
 }