private string GetFilePath()
        {
            string text = null;

            for (int i = 0; i < 10; i++)
            {
                try
                {
                    text = this.ReadKeyFromConfig(this.configSource, this.key);
                    break;
                }
                catch (ConfigurationErrorsException ex)
                {
                    InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Configsource: {0}, had ConfigurationErrorsException, will retry in 500ms. Exception: {1}", new object[]
                    {
                        this.configSource,
                        ex
                    });
                    Thread.Sleep(500);
                }
            }
            if (text == null)
            {
                text = ConfigFiles.GetConfigFilePath(this.defaultFileName);
                InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "Using default file path: {0}", new object[]
                {
                    text
                });
            }
            else
            {
                InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "Appconfig redirection, using file: {0}", new object[]
                {
                    text
                });
            }
            return(text);
        }
Esempio n. 2
0
        internal static string GetConfigFilePath(string fileName)
        {
            string text = null;

            try
            {
                text = ConfigFiles.GetSystemDriveDirectory();
            }
            catch (SecurityException)
            {
                text = null;
            }
            if (string.IsNullOrEmpty(text) || text.Length != 2)
            {
                return(null);
            }
            text += ConfigFiles.DirectorySeparator;
            if (!Directory.Exists(text))
            {
                return(null);
            }
            return(Path.Combine(text, fileName));
        }
Esempio n. 3
0
 internal static string GetDefaultInMemoryConfigFilePath()
 {
     return(ConfigFiles.GetConfigFilePath("EnabledInMemoryTraces.Config"));
 }