/// <summary> /// Try to auto-detect which parser is suitable given a system string. /// </summary> public void Init(FtpOperatingSystem system, FtpParser defaultParser) { ParserConfirmed = false; if (system == FtpOperatingSystem.Windows) { CurrentParser = FtpParser.Windows; } else if (system == FtpOperatingSystem.Unix) { CurrentParser = FtpParser.Unix; } else if (system == FtpOperatingSystem.VMS) { CurrentParser = FtpParser.VMS; } else if (system == FtpOperatingSystem.IBMOS400) { CurrentParser = FtpParser.IBM; } else { CurrentParser = defaultParser; client.LogStatus(FtpTraceLevel.Warn, "Cannot auto-detect listing parser for system '" + system + "', using " + defaultParser + " parser"); } DetectedParser = CurrentParser; }
/// <summary> /// Try to auto-detect which parser is suitable given a system string. /// </summary> public void Init(FtpOperatingSystem system, FtpParser forcedParser = FtpParser.Auto) { ParserConfirmed = false; if (forcedParser != FtpParser.Auto) { // use the parser that the server handler specified CurrentParser = forcedParser; } else { if (system == FtpOperatingSystem.Windows) { CurrentParser = FtpParser.Windows; } else if (system == FtpOperatingSystem.Unix || system == FtpOperatingSystem.SunOS) { CurrentParser = FtpParser.Unix; } else if (system == FtpOperatingSystem.VMS) { CurrentParser = FtpParser.VMS; } else if (system == FtpOperatingSystem.IBMzOS) { CurrentParser = FtpParser.IBMzOS; } else if (system == FtpOperatingSystem.IBMOS400) { CurrentParser = FtpParser.IBMOS400; } else { CurrentParser = FtpParser.Unix; client.LogStatus(FtpTraceLevel.Warn, "Cannot auto-detect listing parser for system '" + system + "', using Unix parser"); } } DetectedParser = CurrentParser; client.LogStatus(FtpTraceLevel.Verbose, "Listing parser set to: " + DetectedParser.ToString()); }