예제 #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
파일: SyncFilter.cs 프로젝트: zyfzgt/FTPbox
 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
파일: SyncFilter.cs 프로젝트: zyfzgt/FTPbox
        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
파일: SyncFilter.cs 프로젝트: zyfzgt/FTPbox
        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
파일: SyncFilter.cs 프로젝트: zyfzgt/FTPbox
 public abstract bool IsIgnored(ClientItem item);
예제 #14
0
파일: SyncFilter.cs 프로젝트: zyfzgt/FTPbox
        public virtual bool IsIgnored(FileInfo fInfo)
        {
            var cItem = new ClientItem(fInfo);

            return(IsIgnored(cItem));
        }