protected void LoadLines(string configFileName, ConfigurationDocument.LineProcessor processLine)
        {
            Stream stream = null;

            InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "Trying to load trace file: {0}", new object[]
            {
                configFileName
            });
            int num = 20;

            while (num >= 0 && stream == null)
            {
                try
                {
                    stream = this.GetStreamFromFile(configFileName);
                    break;
                }
                catch (FileNotFoundException)
                {
                    InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "File does not exist", new object[0]);
                    throw;
                }
                catch (UnauthorizedAccessException)
                {
                    InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Failed to load file, UnauthorizedAccessException", new object[0]);
                    if (num == 0)
                    {
                        throw;
                    }
                }
                catch (SecurityException)
                {
                    InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Failed to load file, SecurityException", new object[0]);
                    if (num == 0)
                    {
                        throw;
                    }
                }
                catch (IOException)
                {
                    InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Failed to load file, IOException", new object[0]);
                    if (num == 0)
                    {
                        throw;
                    }
                }
                InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Retrying file load in 500 ms", new object[0]);
                Thread.Sleep(500);
                num--;
            }
            byte[] array;
            using (BinaryReader binaryReader = new BinaryReader(stream))
            {
                array = binaryReader.ReadBytes((int)stream.Length);
            }
            this.FileContentHash = TraceConfigSync.ComputeContentHash(array);
            using (TextReader textReader = new StringReader(ConfigurationDocument.Encoding.GetString(array, 0, array.Length)))
            {
                string processedLine;
                while ((processedLine = textReader.ReadLine()) != null)
                {
                    this.currentLine++;
                    processLine(processedLine);
                }
            }
            InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "Done reading config file: {0}, {1} lines were processed", new object[]
            {
                configFileName,
                this.currentLine
            });
        }
 private static ConfigurationDocument LoadFromFile(string path, ConfigurationDocument configDoc, ConfigurationDocument.LineProcessor processLine)
 {
     try
     {
         if (File.Exists(path))
         {
             configDoc.LoadLines(path, processLine);
         }
         else
         {
             InternalBypassTrace.TracingConfigurationTracer.TraceDebug(0, 0L, "File {0} does not exist", new object[]
             {
                 path
             });
         }
     }
     catch (IOException)
     {
         configDoc = new ConfigurationDocument();
         InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Clearing trace settings due to IOException opening file {0}", new object[]
         {
             path
         });
     }
     catch (UnauthorizedAccessException)
     {
         InternalBypassTrace.TracingConfigurationTracer.TraceError(0, 0L, "Trace settings unchanged due to UnauthorizedAccessException opening file {0}", new object[]
         {
             path
         });
     }
     return(configDoc);
 }