Class Filter
Provides filter functionality to get partial object model data
Inheritance
Inherited Members
Namespace: DuetControlServer.Model
Assembly: DuetControlServer.dll
Syntax
public static class Filter
Methods
ConvertFilter(String, Boolean)
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 |
---|---|---|
System.String | filter | Filter expression |
System.Boolean | codeExpression | Whether the filter is from a G-code expression |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.String[] | filter | Filter expression |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | filters | Delimited filter expressions |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.String | filters | Delimited filter expressions |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.Object[] | filter | Array consisting of case-insensitive property names or item indices |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.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, Boolean, 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 |
---|---|---|
System.String | filter | Filter for finding a property or a list item |
System.Boolean | findSbcProperty | Whether the object may be an SBC property |
System.Object | result | Partial object model or null |
Returns
Type | Description |
---|---|
System.Boolean | 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 |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.Object> | a | First partial object model |
System.Collections.Generic.Dictionary<System.String, System.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 |
---|---|---|
System.Object[] | path | Patch path |
System.Object[] | filter | Path filter |
Returns
Type | Description |
---|---|
System.Boolean | True if a filter applies |