コード例 #1
0
        public static ByteQuantifiedSize MBStringToByteQuantifiedSize(object value)
        {
            string text = value as string;

            if (text != null)
            {
                return(ByteQuantifiedSize.Parse((ulong.Parse(text) * 1024UL * 1024UL).ToString()));
            }
            throw new ArgumentException("The argument should be string.");
        }
コード例 #2
0
        public static ByteQuantifiedSize?ToByteSize(this int size)
        {
            ByteQuantifiedSize?result = new ByteQuantifiedSize?(default(ByteQuantifiedSize));

            if (size == 0)
            {
                result = null;
            }
            else
            {
                result = new ByteQuantifiedSize?(ByteQuantifiedSize.Parse(size.ToString() + ByteQuantifiedSize.Quantifier.KB.ToString()));
            }
            return(result);
        }
コード例 #3
0
ファイル: KeywordHit.cs プロジェクト: YHZX2013/exchange_diff
        public static KeywordHit Parse(string value)
        {
            string[] array = value.Split(new char[]
            {
                '\t'
            });
            int count = int.Parse(array[array.Length - 3]);
            ByteQuantifiedSize size = ByteQuantifiedSize.Parse(array[array.Length - 2]);
            int mailboxCount        = int.Parse(array[array.Length - 1]);

            return(new KeywordHit
            {
                Phrase = string.Join("\t", array, 0, array.Length - 3),
                Count = count,
                Size = size,
                MailboxCount = mailboxCount
            });
        }
コード例 #4
0
        // Token: 0x0600019A RID: 410 RVA: 0x00006C8C File Offset: 0x00004E8C
        protected virtual void LoadSettings()
        {
            this.Tracer.TraceDebug <string>(0L, "Start loading {0} settings.", this.LogTypeName);
            BoolAppSettingsEntry boolAppSettingsEntry = new BoolAppSettingsEntry("LogEnabled", this.DefaultEnabled, this.Tracer);

            this.Enabled = boolAppSettingsEntry.Value;
            StringAppSettingsEntry stringAppSettingsEntry = new StringAppSettingsEntry("LogDirectoryPath", Path.Combine(ExchangeSetupContext.LoggingPath, this.LogSubFolderName), this.Tracer);

            this.DirectoryPath = stringAppSettingsEntry.Value;
            TimeSpanAppSettingsEntry timeSpanAppSettingsEntry = new TimeSpanAppSettingsEntry("LogFileAgeInDays", TimeSpanUnit.Days, TimeSpan.FromDays(30.0), this.Tracer);

            this.MaxAge = timeSpanAppSettingsEntry.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry = new ByteQuantifiedSizeAppSettingsEntry("LogDirectorySizeLimit", ByteQuantifiedSize.Parse("100MB"), this.Tracer);

            this.MaxDirectorySize = byteQuantifiedSizeAppSettingsEntry.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry2 = new ByteQuantifiedSizeAppSettingsEntry("LogFileSizeLimit", ByteQuantifiedSize.Parse("10MB"), this.Tracer);

            this.MaxFileSize = byteQuantifiedSizeAppSettingsEntry2.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry3 = new ByteQuantifiedSizeAppSettingsEntry("LogCacheSizeLimit", ByteQuantifiedSize.Parse("2MB"), this.Tracer);

            this.CacheSize = byteQuantifiedSizeAppSettingsEntry3.Value;
            TimeSpanAppSettingsEntry timeSpanAppSettingsEntry2 = new TimeSpanAppSettingsEntry("LogFlushIntervalInSeconds", TimeSpanUnit.Seconds, TimeSpan.FromSeconds(60.0), this.Tracer);

            this.FlushInterval = timeSpanAppSettingsEntry2.Value;
            this.FlushToDisk   = true;
            this.LoadCustomSettings();
            this.Tracer.TraceDebug <string>(0L, "{0} settings are loaded successfully.", this.LogTypeName);
        }
コード例 #5
0
 protected override object ParseObject(string s, IFormatProvider provider)
 {
     return(ByteQuantifiedSize.Parse(s, ByteQuantifiedSize.Quantifier.KB));
 }
コード例 #6
0
 private static void LoadAppConfig()
 {
     Configuration.settingsAppConfig                = null;
     Configuration.settingsDefaultConfig            = null;
     Configuration.ProtocolLoggingEnabled           = Configuration.GetConfigBool("ProtocolLoggingEnabled", false);
     Configuration.ApplyHourPrecision               = Configuration.GetConfigBool("ApplyHourPrecision", true);
     Configuration.MaxDirectorySize                 = Configuration.GetConfigByteQuantifiedSize("MaxDirectorySize", ByteQuantifiedSize.Parse("1GB"));
     Configuration.LogFilePath                      = Configuration.GetConfigString("LogFilePath", ProtocolLog.DefaultLogFilePath);
     Configuration.MaxRetentionPeriod               = Configuration.GetConfigInt("MaxRetentionPeriod", 720);
     Configuration.PerFileMaxSize                   = Configuration.GetConfigByteQuantifiedSize("PerFileMaxSize", ByteQuantifiedSize.Parse("10MB"));
     Configuration.CrashOnUnhandledException        = Configuration.GetConfigBool("CrashOnUnhandledException", false);
     Configuration.ModCacheExpiryTimeInSeconds      = Configuration.GetConfigInt("ModCacheExpiryTimeInSeconds", 7200);
     Configuration.AverageLatencySamples            = Configuration.GetConfigInt("AverageLatencySamples", 1024);
     Configuration.NspiTestServer                   = Configuration.GetConfigString("NspiTestServer", string.Empty);
     Configuration.SuppressNspiEndpointRegistration = Configuration.GetConfigBool("SuppressNspiEndpointRegistration", false);
     Configuration.ADTimeout        = new TimeSpan?(TimeSpan.FromSeconds((double)Configuration.GetConfigInt("ADTimeout", 30)));
     Configuration.MaxExecutionTime = TimeSpan.FromSeconds((double)Configuration.GetConfigInt("MaxExecutionTime", 15));
 }
コード例 #7
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);
        }
コード例 #8
0
        internal static AuditingOpticsLoggerSettings Load()
        {
            AuditingOpticsLoggerSettings.Tracer.TraceDebug(0L, "Start loading Auditing Optics log settings.");
            AuditingOpticsLoggerSettings auditingOpticsLoggerSettings = new AuditingOpticsLoggerSettings();
            BoolAppSettingsEntry         boolAppSettingsEntry         = new BoolAppSettingsEntry("LogEnabled", true, AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.Enabled = boolAppSettingsEntry.Value;
            StringAppSettingsEntry stringAppSettingsEntry = new StringAppSettingsEntry("LogDirectoryPath", Path.Combine(ExchangeSetupContext.LoggingPath, AuditingOpticsConstants.LoggerComponentName), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.DirectoryPath = stringAppSettingsEntry.Value;
            TimeSpanAppSettingsEntry timeSpanAppSettingsEntry = new TimeSpanAppSettingsEntry("LogFileAgeInDays", TimeSpanUnit.Days, TimeSpan.FromDays(30.0), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.MaxAge = timeSpanAppSettingsEntry.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry = new ByteQuantifiedSizeAppSettingsEntry("LogDirectorySizeLimit", ByteQuantifiedSize.Parse("100MB"), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.MaxDirectorySize = byteQuantifiedSizeAppSettingsEntry.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry2 = new ByteQuantifiedSizeAppSettingsEntry("LogFileSizeLimit", ByteQuantifiedSize.Parse("10MB"), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.MaxFileSize = byteQuantifiedSizeAppSettingsEntry2.Value;
            ByteQuantifiedSizeAppSettingsEntry byteQuantifiedSizeAppSettingsEntry3 = new ByteQuantifiedSizeAppSettingsEntry("LogCacheSizeLimit", ByteQuantifiedSize.Parse("256KB"), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.CacheSize = byteQuantifiedSizeAppSettingsEntry3.Value;
            TimeSpanAppSettingsEntry timeSpanAppSettingsEntry2 = new TimeSpanAppSettingsEntry("LogFlushIntervalInSeconds", TimeSpanUnit.Seconds, TimeSpan.FromSeconds(60.0), AuditingOpticsLoggerSettings.Tracer);

            auditingOpticsLoggerSettings.FlushInterval = timeSpanAppSettingsEntry2.Value;
            auditingOpticsLoggerSettings.FlushToDisk   = true;
            AuditingOpticsLoggerSettings.Tracer.TraceDebug(0L, "The Auditing Optics log settings are loaded successfully.");
            return(auditingOpticsLoggerSettings);
        }
コード例 #9
0
 public ByteQuantifiedSize ToByteQuantifiedSize()
 {
     return(ByteQuantifiedSize.Parse(this.canonical));
 }