Example #1
0
 public static void RefreshConfig(string config)
 {
     if (string.IsNullOrEmpty(config))
     {
         return;
     }
     ExchangeBinaryFormatterFactory.ConfigureDefaultSettings();
     if (config.StartsWith("LoggingDisabled", StringComparison.OrdinalIgnoreCase))
     {
         ExchangeBinaryFormatterFactory.LoggingEnabled = false;
         return;
     }
     if (config.StartsWith("LoggingEnabled", StringComparison.OrdinalIgnoreCase))
     {
         ExchangeBinaryFormatterFactory.LoggingEnabled = true;
         if (config.IndexOf(';') > -1)
         {
             string[] array = config.Split(new char[]
             {
                 ';'
             });
             if (array.Length > 1)
             {
                 for (int i = 1; i < array.Length; i++)
                 {
                     if (array[i].Equals("IncludeStackTrace", StringComparison.OrdinalIgnoreCase))
                     {
                         ExchangeBinaryFormatterFactory.IncludeStackTrace = true;
                     }
                     if (array[i].Equals("ClearAfterSave", StringComparison.OrdinalIgnoreCase))
                     {
                         ExchangeBinaryFormatterFactory.ClearAfterSave = true;
                     }
                     if (array[i].StartsWith("LogDumpInterval", StringComparison.OrdinalIgnoreCase))
                     {
                         ExchangeBinaryFormatterFactory.LogDumpInterval = ExchangeBinaryFormatterFactory.GetTimespanForLogDumpInterval(array[i]);
                     }
                 }
                 return;
             }
         }
     }
     else
     {
         ExchangeBinaryFormatterFactory.ConfigureDefaultSettings();
     }
 }
Example #2
0
 private static IDeserializedTypesGatherer BuildTypeGatherer()
 {
     try
     {
         string logDirectory = ExchangeBinaryFormatterFactory.GetLogDirectory();
         if (logDirectory != null)
         {
             return(new FileBasedDeserializedTypeGatherer(logDirectory, ExchangeBinaryFormatterFactory.LogDumpInterval)
             {
                 AddStackTrace = ExchangeBinaryFormatterFactory.IncludeStackTrace,
                 ClearAfterSave = ExchangeBinaryFormatterFactory.ClearAfterSave
             });
         }
     }
     catch
     {
     }
     return(null);
 }
Example #3
0
 public static string GetLogDirectory()
 {
     using (RegistryKey registryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
     {
         if (registryKey != null)
         {
             using (RegistryKey registryKey2 = registryKey.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Setup"))
             {
                 if (registryKey2 != null)
                 {
                     object value = registryKey2.GetValue("MsiInstallPath");
                     return((value != null) ? Path.Combine(value.ToString(), "Logging", "TypeDeserialization", ExchangeBinaryFormatterFactory.GetProtocolName()) : null);
                 }
             }
         }
     }
     return(null);
 }
Example #4
0
 private static void HandleConfigReadError(string error)
 {
     ExchangeBinaryFormatterFactory.ConfigError = DateTime.UtcNow + "-" + error;
     ExchangeBinaryFormatterFactory.ConfigureDefaultSettings();
 }
Example #5
0
        private static string GetProtocolName()
        {
            string result;

            using (Process currentProcess = Process.GetCurrentProcess())
            {
                result = (string.Equals(currentProcess.ProcessName, "w3wp", StringComparison.OrdinalIgnoreCase) ? ExchangeBinaryFormatterFactory.GetAppPoolId() : currentProcess.ProcessName);
            }
            return(result);
        }