/// <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); } } }
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); }
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); }
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); }
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)); }
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); }
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); }
/// <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; }
/// <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; }
public abstract bool Validate(ClientItem local, string remote);
public abstract bool Validate(string local, ClientItem remote);
public bool IsFilteredOut(ClientItem item) => Filters.Any(x => x.IsIgnored(item));
public abstract bool IsIgnored(ClientItem item);
public virtual bool IsIgnored(FileInfo fInfo) { var cItem = new ClientItem(fInfo); return(IsIgnored(cItem)); }