示例#1
0
        /// <summary>
        ///     Returns a fully recursive listing inside the specified (directory) item
        /// </summary>
        /// <param name="p">The clientItem (should be of type directory) to list inside</param>
        /// <param name="skipIgnored">if true, ignored items are not returned</param>
        private IEnumerable <ClientItem> ListRecursiveInside(ClientItem p, bool skipIgnored = true)
        {
            yield return(p);

            var cpath = _controller.GetCommonPath(p.FullPath, false);

            var list = new List <ClientItem>(List(cpath, skipIgnored).ToList());

            if (ListingFailed)
            {
                yield break;
            }

            if (skipIgnored)
            {
                list.RemoveAll(x => !_controller.ItemGetsSynced(x.FullPath, false));
            }

            foreach (var f in list.Where(x => x.Type == ClientItemType.File))
            {
                yield return(f);
            }

            foreach (var d in list.Where(x => x.Type == ClientItemType.Folder))
            {
                foreach (var f in ListRecursiveInside(d, skipIgnored))
                {
                    yield return(f);
                }
            }
        }
示例#2
0
        public override bool Validate(string local, ClientItem remote)
        {
            var expectedSize = new FileInfo(local).Length;

            Log.Write(l.Debug, $"Validating size of {remote.Name} : expected {expectedSize} was {remote.Size}");

            return(remote.Size == expectedSize);
        }
示例#3
0
        public override bool Validate(ClientItem local, string remote)
        {
            var expectedSize = Controller.Client.SizeOf(remote);

            Log.Write(l.Debug, $"Validating size of {local.Name} : expected {expectedSize} was {local.Size}");

            return(local.Size == expectedSize);
        }
示例#4
0
 public override bool IsIgnored(ClientItem item)
 {
     if (item.LastWriteTime < MinimumLastModified)
     {
         Log.Write(l.Debug, $"File ignored because it is older than {MinimumLastModified}: {item.FullPath}");
         return(true);
     }
     return(false);
 }
示例#5
0
        public bool ItemSkipped(ClientItem item)
        {
            var cpath = GetCommonPath(item.FullPath, false);

            if (cpath.EndsWith("/"))
            {
                cpath = cpath.Substring(0, cpath.Length - 1);
            }

            return(ItemSkipped(cpath, item.Name) || IgnoreList.IsIgnored(cpath) || IgnoreList.IsFilteredOut(item));
        }
示例#6
0
        public override bool IsIgnored(ClientItem item)
        {
            var name = item.Name;

            // are dotfiles ignored?
            if (IgnoreDotFiles && name.StartsWith("."))
            {
                Log.Write(l.Debug, $"File ignored because it is a dotfile: {item.FullPath}");
                return(true);
            }
            // are temporary files ignored?
            if (IgnoreTempFiles && (name.ToLower().EndsWith(".tmp") || name.EndsWith("~") || name.StartsWith(".goutputstream") || name.StartsWith("~") || name.Equals("Thumbs.db")))
            {
                Log.Write(l.Debug, $"File ignored because it is a temp file: {item.FullPath}");
                return(true);
            }

            return(false);
        }
示例#7
0
        public override bool IsIgnored(ClientItem item)
        {
            var name = item.Name;

            var ext = name.Contains(".")
                ? name.Substring(name.LastIndexOf(".", StringComparison.Ordinal) + 1)
                : string.Empty;

            if (string.IsNullOrEmpty(ext))
            {
                return(false);
            }

            if (IgnoredExtensions.Contains(ext) || IgnoredExtensions.Contains("." + ext))
            {
                Log.Write(l.Debug, $"File ignored because of its extension: {item.Name}");
                return(true);
            }
            return(false);
        }
示例#8
0
文件: Client.cs 项目: CKoewing/FTPbox
        /// <summary>
        /// Returns a fully recursive listing inside the specified (directory) item
        /// </summary>
        /// <param name="p">The clientItem (should be of type directory) to list inside</param>
        /// <param name="skipIgnored">if true, ignored items are not returned</param>
        private IEnumerable<ClientItem> ListRecursiveInside(ClientItem p, bool skipIgnored = true)
        {
            yield return p;

            var cpath = controller.GetCommonPath(p.FullPath, false);

            var list = new List<ClientItem>(List(cpath, skipIgnored).ToList());
            if (ListingFailed) yield break;

            if (skipIgnored)
                list.RemoveAll(x => !controller.ItemGetsSynced(controller.GetCommonPath(x.FullPath, false)));

            foreach (var f in list.Where(x => x.Type == ClientItemType.File))
                yield return f;

            foreach (var d in list.Where(x => x.Type == ClientItemType.Folder))
                foreach (var f in ListRecursiveInside(d, skipIgnored))
                    yield return f;
        }
示例#9
0
文件: Client.cs 项目: nelsont/FTPbox
        /// <summary>
        /// Returns a fully recursive listing inside the specified (directory) item
        /// </summary>
        /// <param name="p">The clientItem (should be of type directory) to list inside</param>
        private static IEnumerable<ClientItem> ListRecursiveInside(ClientItem p)
        {
            yield return p;

            var cpath = Common.GetCommonPath(p.FullPath, false);

            var list = new List<ClientItem>(List(cpath).ToList());
            if (ListingFailed) yield break;

            list.RemoveAll(x => !Common.ItemGetsSynced(Common.GetCommonPath(x.FullPath, false)));

            foreach (var f in list.Where(x => x.Type == ClientItemType.File))
                yield return f;

            foreach (var d in list.Where(x => x.Type == ClientItemType.Folder))
                foreach (var f in ListRecursiveInside(d))
                    yield return f;
        }
示例#10
0
 public abstract bool Validate(ClientItem local, string remote);
示例#11
0
 public abstract bool Validate(string local, ClientItem remote);
示例#12
0
 public bool IsFilteredOut(ClientItem item) => Filters.Any(x => x.IsIgnored(item));
示例#13
0
 public abstract bool IsIgnored(ClientItem item);
示例#14
0
        public virtual bool IsIgnored(FileInfo fInfo)
        {
            var cItem = new ClientItem(fInfo);

            return(IsIgnored(cItem));
        }