コード例 #1
0
ファイル: FTPFileFactory.cs プロジェクト: sunxiaoguang/i360gm
 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());
     }
 }
コード例 #2
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());
        }
コード例 #3
0
ファイル: FTPFileFactory.cs プロジェクト: sunxiaoguang/i360gm
 private void InitializeParsers()
 {
     this.parsers.Add(this.unix);
     this.parsers.Add(this.windows);
     this.parsers.Add(this.os400);
     this.parsers.Add(this.vms);
     this.parser = this.unix;
 }
コード例 #4
0
 private void InitializeParsers()
 {
     parsers.Add(unix);
     parsers.Add(windows);
     parsers.Add(os400);
     parsers.Add(vms);
     parser = unix;
 }
コード例 #5
0
 /// <summary> Swap from one parser to the other. We can just check
 /// object references
 /// </summary>
 private void RotateParsers()
 {
     if (parser == unix)
     {
         parser = windows;
         log.Info("Rotated parser to Windows");
     }
     else if (parser == windows)
     {
         parser = unix;
         log.Info("Rotated parser to Unix");
     }
 }
コード例 #6
0
 public FTPFileFactory()
 {
     this.log = Logger.GetLogger("FTPFileFactory");
     this.windows = new WindowsFileParser();
     this.unix = new UnixFileParser();
     this.vms = new VMSFileParser();
     this.os400 = new OS400FileParser();
     this.parser = null;
     this.parsers = new ArrayList();
     this.userSetParser = false;
     this.parserDetected = false;
     this.parserCulture = CultureInfo.InvariantCulture;
     this.timeDiff = new TimeSpan();
     this.InitializeParsers();
 }
コード例 #7
0
ファイル: FTPFileFactory.cs プロジェクト: sunxiaoguang/i360gm
 public FTPFileFactory()
 {
     this.log            = Logger.GetLogger("FTPFileFactory");
     this.windows        = new WindowsFileParser();
     this.unix           = new UnixFileParser();
     this.vms            = new VMSFileParser();
     this.os400          = new OS400FileParser();
     this.parser         = null;
     this.parsers        = new ArrayList();
     this.userSetParser  = false;
     this.parserDetected = false;
     this.parserCulture  = CultureInfo.InvariantCulture;
     this.timeDiff       = new TimeSpan();
     this.InitializeParsers();
 }
コード例 #8
0
 /// <summary> Set the remote server type
 ///
 /// </summary>
 /// <param name="system">   SYST string
 /// </param>
 private void SetParser(string system)
 {
     this.system = system;
     if (system.ToUpper().StartsWith(WINDOWS_STR))
     {
         parser = windows;
     }
     else if (system.ToUpper().StartsWith(UNIX_STR))
     {
         parser = unix;
     }
     else
     {
         throw new FTPException("Unknown SYST: " + system);
     }
 }
コード例 #9
0
        /// <summary>
        /// Set the remote server type
        /// </summary>
        /// <param name="system">SYST string</param>
        public void SetParser(string system)
        {
            parserDetected = false;
            this.system    = system != null?system.Trim() : null;

            if (system != null)
            {
                if (system.ToUpper().StartsWith(WINDOWS_STR))
                {
                    log.Debug("Selected Windows parser");
                    parser = windows;
                }
                else if (system.ToUpper().IndexOf(UNIX_STR) >= 0 ||
                         system.ToUpper().IndexOf(AIX_STR) >= 0)
                {
                    log.Debug("Selected UNIX parser");
                    parser = unix;
                }
                else if (system.ToUpper().IndexOf(VMS_STR) >= 0)
                {
                    log.Debug("Selected VMS parser");
                    parser = vms;
                }
                else if (system.ToUpper().IndexOf(OS400_STR) >= 0)
                {
                    log.Debug("Selected OS/400 parser");
                    parser = os400;
                }
                else
                {
                    parser = unix;
                    log.Warn("Unknown SYST '" + system + "' - defaulting to Unix parsing");
                }
            }
            else
            {
                parser = unix;
                log.Debug("Defaulting to Unix parsing");
            }
        }
コード例 #10
0
ファイル: FTPFileFactory.cs プロジェクト: sunxiaoguang/i360gm
 public void SetParser(string system)
 {
     this.parserDetected = false;
     this.system         = (system != null) ? system.Trim() : null;
     if (system != null)
     {
         if (system.ToUpper().StartsWith("WINDOWS"))
         {
             this.log.Debug("Selected Windows parser");
             this.parser = this.windows;
         }
         else if (system.ToUpper().IndexOf("UNIX") >= 0)
         {
             this.log.Debug("Selected UNIX parser");
             this.parser = this.unix;
         }
         else if (system.ToUpper().IndexOf("VMS") >= 0)
         {
             this.log.Debug("Selected VMS parser");
             this.parser = this.vms;
         }
         else if (system.ToUpper().IndexOf("OS/400") >= 0)
         {
             this.log.Debug("Selected OS/400 parser");
             this.parser = this.os400;
         }
         else
         {
             this.parser = this.unix;
             this.log.Warn("Unknown SYST '" + system + "' - defaulting to Unix parsing");
         }
     }
     else
     {
         this.parser = this.unix;
         this.log.Debug("Defaulting to Unix parsing");
     }
 }
コード例 #11
0
 /// <summary>
 /// Rather than forcing a parser (as in the constructor that accepts
 /// a parser), this adds a parser to the list of those used.
 /// </summary>
 /// <param name="parser">parser to add to list being used</param>
 public void AddParser(FTPFileParser parser)
 {
     parsers.Add(parser);
 }
コード例 #12
0
ファイル: FTPFileFactory.cs プロジェクト: tinygg/Tools.Net
		/// <summary> 
		/// Set the remote server type
		/// </summary>
		/// <param name="system">SYST string</param>
		public void SetParser(string system)
		{
            parserDetected = false;
            this.system = system != null ? system.Trim() : null;
            if (system != null)
            {
                if (system.ToUpper().StartsWith(WINDOWS_STR))
                {
                    log.Debug("Selected Windows parser");
                    parser = windows;
                }
                else if (system.ToUpper().IndexOf(UNIX_STR) >= 0||
                    system.ToUpper().IndexOf(AIX_STR) >= 0)
                {
                    log.Debug("Selected UNIX parser");
                    parser = unix;
                }
                else if (system.ToUpper().IndexOf(VMS_STR) >= 0)
                {
                    log.Debug("Selected VMS parser");
                    parser = vms;
                }
                else if (system.ToUpper().IndexOf(OS400_STR) >= 0)
                {
                    log.Debug("Selected OS/400 parser");
                    parser = os400;
                }
                else
                {
                    parser = unix;
                    log.Warn("Unknown SYST '" + system + "' - defaulting to Unix parsing");
                }
            }
            else
            {
                parser = unix;
                log.Debug("Defaulting to Unix parsing");
            }
		}
コード例 #13
0
 /// <summary> Constructor. User supplied parser. Note that parser
 /// detection is disabled if a parser is explicitly supplied
 /// </summary>
 /// <param name="parser">  the parser to use
 /// </param>
 public FTPFileFactory(FTPFileParser parser)
 {
     InitializeParsers();
     this.parser = parser;
 }
コード例 #14
0
ファイル: FTPFileFactory.cs プロジェクト: tinygg/Tools.Net
 /// <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());
 }
コード例 #15
0
 /// <summary> Swap from one parser to the other. We can just check
 /// object references
 /// </summary>
 private void RotateParsers()
 {
     if (parser == unix)
     {
         parser = windows;
         log.Info("Rotated parser to Windows");
     }
     else if (parser == windows)
     {
         parser = unix;
         log.Info("Rotated parser to Unix");
     }
 }
コード例 #16
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());
     }
 }
コード例 #17
0
 public void AddParser(FTPFileParser parser)
 {
     this.parsers.Add(parser);
 }
コード例 #18
0
ファイル: FTPFileFactory.cs プロジェクト: tinygg/Tools.Net
 private void InitializeParsers()
 {
     parsers.Add(unix);
     parsers.Add(windows);
     parsers.Add(os400);
     parsers.Add(vms);
     parser = unix;
 }
コード例 #19
0
 public void SetParser(string system)
 {
     this.parserDetected = false;
     this.system = (system != null) ? system.Trim() : null;
     if (system != null)
     {
         if (system.ToUpper().StartsWith("WINDOWS"))
         {
             this.log.Debug("Selected Windows parser");
             this.parser = this.windows;
         }
         else if (system.ToUpper().IndexOf("UNIX") >= 0)
         {
             this.log.Debug("Selected UNIX parser");
             this.parser = this.unix;
         }
         else if (system.ToUpper().IndexOf("VMS") >= 0)
         {
             this.log.Debug("Selected VMS parser");
             this.parser = this.vms;
         }
         else if (system.ToUpper().IndexOf("OS/400") >= 0)
         {
             this.log.Debug("Selected OS/400 parser");
             this.parser = this.os400;
         }
         else
         {
             this.parser = this.unix;
             this.log.Warn("Unknown SYST '" + system + "' - defaulting to Unix parsing");
         }
     }
     else
     {
         this.parser = this.unix;
         this.log.Debug("Defaulting to Unix parsing");
     }
 }
コード例 #20
0
 private void InitializeParsers()
 {
     this.parsers.Add(this.unix);
     this.parsers.Add(this.windows);
     this.parsers.Add(this.os400);
     this.parsers.Add(this.vms);
     this.parser = this.unix;
 }
コード例 #21
0
 /// <summary> Constructor. User supplied parser. Note that parser
 /// rotation (in case of a ParseException) is disabled if
 /// a parser is explicitly supplied
 /// 
 /// </summary>
 /// <param name="parser">  the parser to use
 /// </param>
 public FTPFileFactory(FTPFileParser parser)
 {
     InitBlock();
     this.parser = parser;
     rotateParsersOnFail = false;
 }
コード例 #22
0
 /// <summary> Set the remote server type
 /// 
 /// </summary>
 /// <param name="system">   SYST string
 /// </param>
 private void SetParser(string system)
 {
     this.system = system;
     if (system.ToUpper().StartsWith(WINDOWS_STR))
         parser = windows;
     else if (system.ToUpper().StartsWith(UNIX_STR))
         parser = unix;
     else
         throw new FTPException("Unknown SYST: " + system);
 }
コード例 #23
0
ファイル: FTPFileFactory.cs プロジェクト: tinygg/Tools.Net
		/// <summary> Constructor. User supplied parser. Note that parser
		/// detection is disabled if a parser is explicitly supplied
		/// </summary>
		/// <param name="parser">  the parser to use
		/// </param>
		public FTPFileFactory(FTPFileParser parser)
		{
            InitializeParsers();
			this.parser = parser;
		}
コード例 #24
0
 /// <summary> Constructor. User supplied parser. Note that parser
 /// rotation (in case of a ParseException) is disabled if
 /// a parser is explicitly supplied
 ///
 /// </summary>
 /// <param name="parser">  the parser to use
 /// </param>
 public FTPFileFactory(FTPFileParser parser)
 {
     InitBlock();
     this.parser         = parser;
     rotateParsersOnFail = false;
 }