Class Filter
Provides filter functionality to get partial object model data
Inherited Members
Namespace: DuetControlServer.Model
Assembly: DuetControlServer.dll
Syntax
public static class Filter
Methods
ConvertFilter(string, bool)
Convert a filter string into an object array that can be used to traverse the object model
Declaration
public static object[] ConvertFilter(string filter, bool codeExpression)
Parameters
Type | Name | Description |
---|---|---|
string | filter | Filter expression |
bool | codeExpression | Whether the filter is from a G-code expression |
Returns
Type | Description |
---|---|
object[] | Object array |
ConvertFilter(string[])
Convert filter string items into an object array that can be used to traverse the object model
Declaration
public static object[] ConvertFilter(string[] filter)
Parameters
Type | Name | Description |
---|---|---|
string[] | filter | Filter expression |
Returns
Type | Description |
---|---|
object[] | Object array |
ConvertFilters(IEnumerable<string>)
Convert multiple filter strings into an object array that can be used to traverse the object model
Declaration
public static object[][] ConvertFilters(IEnumerable<string> filters)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | filters | Delimited filter expressions |
Returns
Type | Description |
---|---|
object[][] | Object array |
ConvertFilters(string)
Convert delimited filter strings into an object array that can be used to traverse the object model
Declaration
public static object[][] ConvertFilters(string filters)
Parameters
Type | Name | Description |
---|---|---|
string | filters | Delimited filter expressions |
Returns
Type | Description |
---|---|
object[][] | Object array |
GetFiltered(object[])
Get a partial object model with only fields that match the given filter
Declaration
public static Dictionary<string, object?> GetFiltered(object[] filter)
Parameters
Type | Name | Description |
---|---|---|
object[] | filter | Array consisting of case-insensitive property names or item indices |
Returns
Type | Description |
---|---|
Dictionary<string, object> | Dictionary holding the results or null if nothing could be found |
Remarks
Make sure the model provider is locked in read-only mode before using this class
See Also
GetFiltered(string)
Get a partial object model with only fields that match the given filter
Declaration
public static Dictionary<string, object?> GetFiltered(string filter)
Parameters
Type | Name | Description |
---|---|---|
string | filter | Filter string |
Returns
Type | Description |
---|---|
Dictionary<string, object> | Dictionary holding the results or null if nothing could be found |
Remarks
Make sure the model provider is locked in read-only mode before using this class
See Also
GetSpecific(string, bool, out object?)
Find a specific object in the object model (wildcards are not supported)
Declaration
public static bool GetSpecific(string filter, bool findSbcProperty, out object? result)
Parameters
Type | Name | Description |
---|---|---|
string | filter | Filter for finding a property or a list item |
bool | findSbcProperty | Whether the object may be an SBC property |
object | result | Partial object model or null |
Returns
Type | Description |
---|---|
bool | Whether the object could be found |
MergeFiltered(Dictionary<string, object?>, Dictionary<string, object?>)
Merge two filtered object models
Declaration
public static void MergeFiltered(Dictionary<string, object?> a, Dictionary<string, object?> b)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<string, object> | a | First partial object model |
Dictionary<string, object> | b | Second partial object model |
PathMatches(object[], object[])
Checks if a change path matches a given filter
Declaration
public static bool PathMatches(object[] path, object[] filter)
Parameters
Type | Name | Description |
---|---|---|
object[] | path | Patch path |
object[] | filter | Path filter |
Returns
Type | Description |
---|---|
bool | True if a filter applies |