Ejemplo n.º 1
0
        /// <summary>
        /// Detect the parser format to use
        /// </summary>
        /// <param name="files"></param>
        private void DetectParser(string[] files)
        {
            // use the initially set parser (from SYST)
            if (parser.IsValidFormat(files))
            {
                log.Debug("Confirmed format " + parser.ToString());
                parserDetected = true;
                return;
            }
            IEnumerator i = parsers.GetEnumerator();

            while (i.MoveNext())
            {
                FTPFileParser p = (FTPFileParser)i.Current;
                if (p.IsValidFormat(files))
                {
                    parser = p;
                    log.Debug("Detected format " + parser.ToString());
                    parserDetected = true;
                    return;
                }
            }
            parser = unix;
            log.Warn("Could not detect format. Using default " + parser.ToString());
        }
Ejemplo n.º 2
0
 private void DetectParser(string[] files)
 {
     if (this.parser.IsValidFormat(files))
     {
         this.log.Debug("Confirmed format " + this.parser.ToString());
         this.parserDetected = true;
     }
     else
     {
         IEnumerator enumerator = this.parsers.GetEnumerator();
         while (enumerator.MoveNext())
         {
             FTPFileParser current = (FTPFileParser)enumerator.Current;
             if (current.IsValidFormat(files))
             {
                 this.parser = current;
                 this.log.Debug("Detected format " + this.parser.ToString());
                 this.parserDetected = true;
                 return;
             }
         }
         this.parser = this.unix;
         this.log.Warn("Could not detect format. Using default " + this.parser.ToString());
     }
 }