Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Created July 14, 2024 09:02
Show Gist options
  • Save hishaamn/26e73d7953ab2bc3574849def09137c8 to your computer and use it in GitHub Desktop.
Save hishaamn/26e73d7953ab2bc3574849def09137c8 to your computer and use it in GitHub Desktop.
Override current implementation to introduce the SkipFile value
public class CustomEntrySorter : EntrySorter
{
private bool SkipFile { get; set; }
public CustomEntrySorter(ISource<PackageEntry> baseSource, bool skipFile = false) : base(baseSource)
{
this.SkipFile = skipFile;
}
public override void Put(PackageEntry entry)
{
if(this.SkipFile && entry.Properties.ContainsKey("type") && entry.Properties["type"].Equals("file"))
{
Log.Info($"Skipping file {entry.Key}", this);
return;
}
base.Put(entry);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment