-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andreas Pouwels
committed
Feb 12, 2023
1 parent
43d0058
commit 2857a52
Showing
5 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace ZimLabs.CoreLib.Common; | ||
|
||
/// <summary> | ||
/// The different filter types | ||
/// </summary> | ||
public enum FilterType | ||
{ | ||
/// <summary> | ||
/// The value has to contain | ||
/// </summary> | ||
Contains, | ||
|
||
/// <summary> | ||
/// The value has to be equals | ||
/// </summary> | ||
Equals, | ||
|
||
/// <summary> | ||
/// The value has to starts with | ||
/// </summary> | ||
StartsWith, | ||
|
||
/// <summary> | ||
/// The value has to ends with | ||
/// </summary> | ||
EndsWith | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/ZimLabs.CoreLib/ZimLabs.CoreLib/DataObjects/FilterEntry.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using ZimLabs.CoreLib.Common; | ||
|
||
namespace ZimLabs.CoreLib.DataObjects; | ||
|
||
/// <summary> | ||
/// Represents a filter entry | ||
/// </summary> | ||
public class FilterEntry | ||
{ | ||
/// <summary> | ||
/// Gets or sets the value to search for | ||
/// </summary> | ||
public string Value { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the desired filter | ||
/// </summary> | ||
public FilterType FilterType { get; set; } = FilterType.Equals; | ||
|
||
/// <summary> | ||
/// Gets or sets the original value (with wildcards) | ||
/// </summary> | ||
public string OriginalValue { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Creates a new empty instance of the <see cref="FilterEntry"/> | ||
/// </summary> | ||
public FilterEntry() { } | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="FilterEntry"/> | ||
/// </summary> | ||
/// <param name="value">The value to search for</param> | ||
/// <param name="wildcard">The desired wildcard (optional)</param> | ||
public FilterEntry(string value, string wildcard = "*") | ||
{ | ||
Value = value.Replace(wildcard, ""); // Remove the wild card | ||
FilterType = value.ToFilterType(wildcard); | ||
OriginalValue = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters