public static string StringizeExceptions(List <Exception> exceptions)
 {
     if (exceptions == null || exceptions.Count == 0)
     {
         return(string.Empty);
     }
     return(string.Join("&", from ex in exceptions
                        select InferenceCommonUtility.StringizeException(ex)));
 }
 public static bool ConfigTryParseHelper <T>(IPipelineComponentConfig config, InferenceCommonUtility.TryParseFunction <T> tryParseFunction, string keyName, out T value, IDiagnosticsSession trace, T defaultValue)
 {
     if (!InferenceCommonUtility.ConfigTryParseHelper <T>(config, tryParseFunction, keyName, out value, trace))
     {
         value = defaultValue;
         if (trace != null)
         {
             trace.TraceDebug <string, T>("Defaulting config value referenced by keyName: {0} to: {1}", keyName, defaultValue);
         }
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
            private static string GetOfficeDataLoaderConfigurationPath()
            {
                string result = null;

                using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(string.Format("System\\CurrentControlSet\\Services\\{0}", HashProvider.ExchangeDataMiningHashProvider.OfficeDataLoaderServiceName)))
                {
                    if (registryKey != null)
                    {
                        string executablePath = InferenceCommonUtility.GetExecutablePath(registryKey.GetValue("ImagePath") as string);
                        if (!string.IsNullOrEmpty(executablePath))
                        {
                            result = Path.GetDirectoryName(executablePath);
                        }
                    }
                }
                return(result);
            }
Esempio n. 4
0
 protected BaseComponent(IPipelineComponentConfig config)
 {
     InferenceCommonUtility.ConfigTryParseHelper <bool>(config, new InferenceCommonUtility.TryParseFunction <bool>(bool.TryParse), "AsyncComponent", out this.isAsynchronous, this.DiagnosticsSession, false);
     this.DiagnosticsSession = Microsoft.Exchange.Search.Core.Diagnostics.DiagnosticsSession.CreateComponentDiagnosticsSession("BaseComponent", ExTraceGlobals.SynchronousComponentBaseTracer, (long)this.GetHashCode());
 }