Ejemplo n.º 1
0
        /// <summary>
        /// 생성자
        /// </summary>
        /// <param name="line">FTP에서 전송한 directory 정보</param>
        /// <param name="path">현재 디렉토리 경로</param>
        public FtpFileInfo(string line, string path)
        {
            if (IsDebugEnabled)
            {
                log.Debug("Create a new instance of FtpFileInfo with line=[{0}], path=[{1}]", line.EllipsisChar(48),
                          path.EllipsisPath(48));
            }

            var match = GetMatchingRegex(line);

            if (match == null)
            {
                throw new FtpException("Unable to parse line=" + line);
            }

            Filename   = match.Groups["name"].Value;
            FilePath   = path;
            FullName   = string.Concat(FilePath, "/", Filename);
            Permission = match.Groups["permission"].Value;
            Size       = match.Groups["size"].Value.AsLong(0L);

            string dir = match.Groups["dir"].Value;

            FileKind = (dir != string.Empty && dir != "-") ? FtpEntryKind.Directory : FtpEntryKind.File;

            var timestamp = match.Groups["timestamp"].AsText();

            if (timestamp.IsNotWhiteSpace())
            {
                FileDateTime = ConvertTool.ConvertValue(timestamp, typeof(DateTime), English).AsDateTimeNullable();
            }
        }
Ejemplo n.º 2
0
        public void ConvertValueTest()
        {
            object s = "123";
            var    i = (int)ConvertTool.ConvertValue(s, typeof(int));

            Console.WriteLine(i);
        }