コード例 #1
0
        /// <summary>
        /// Returns the LastWriteTime of the specified file/folder
        /// </summary>
        /// <param name="path">The common path to the file/folder</param>
        /// <returns></returns>
        public DateTime GetLwtOf(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                return(DateTime.MinValue);
            }

            if (path.StartsWith("/"))
            {
                path = path.Substring(1);
            }
            var dt = DateTime.MinValue;

            try
            {
                dt = (FTP) ? _ftpc.GetModifiedTime(path) : _sftpc.GetLastWriteTime(path);
            }
            catch (Exception ex)
            {
                Log.Write(l.Client, "===> {0} is a folder", path);
                Common.LogError(ex);
            }

            if (!FTP)
            {
                Log.Write(l.Client, "Got LWT: {0} UTC: {1}", dt, _sftpc.GetLastAccessTimeUtc(path));
            }

            return(dt);
        }
コード例 #2
0
        /// <summary>
        ///     Returns the LastWriteTime of the specified file/folder
        /// </summary>
        /// <param name="path">The common path to the file/folder</param>
        /// <returns></returns>
        public override DateTime GetLwtOf(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                return(DateTime.MinValue);
            }

            if (path.StartsWith("/"))
            {
                path = path.Substring(1);
            }
            var dt = DateTime.MinValue;

            try
            {
                lock (ftpcLock)
                {
                    dt = _ftpc.GetModifiedTime(path);
                }
            }
            catch (Exception ex)
            {
                Log.Write(l.Client, "===> {0} is a folder", path);
                Common.LogError(ex);
            }

            return(dt);
        }