/// <summary> /// Set the progress activity, initial description and total number of records (where applicable) for the current cmdlet. /// </summary> /// <param name="operation">The type of processing that is being performed by this cmdlet.</param> internal void SetObjectSearchProgress(ProcessingOperation operation) { ProgressManager.CurrentRecord.Activity = $"PRTG {TypeDescription} {(ProgressManager.WatchStream ? "Watcher" : "Search")}"; if (operation == ProcessingOperation.Processing) { ProgressManager.InitialDescription = $"Processing {TypeDescription.ToLower()}"; } else { ProgressManager.InitialDescription = $"Retrieving all {GetTypePlural()}"; } }
protected override Expression VisitMethodCall(MethodCallExpression node) { var methodName = node.Method.Name; if (node.Method.DeclaringType != typeof(Queryable) || !_supportedMethods.ContainsKey(methodName)) { return(base.VisitMethodCall(node)); } var previousCall = node.Arguments[0] as MethodCallExpression; if (previousCall != null) { Visit(previousCall); } _operation = _supportedMethods[methodName]; if (_builder.Length > 0) { _builder.Append("&"); } var predicate = node.Arguments[1]; switch (methodName) { case "Where": _builder.Append("q="); Visit(predicate); break; case "OrderBy": _builder.Append("sort="); Visit(predicate); _builder.Append("&order=asc"); break; case "OrderByDescending": _builder.Append("sort="); Visit(predicate); _builder.Append("&order=desc"); break; } _operation = ProcessingOperation.None; return(node); }