private static PrtgNodeType GetNodeType(ITreeValue value) { if (value is ISensor) { return(PrtgNodeType.Sensor); } if (value is IDevice) { return(PrtgNodeType.Device); } if (value is IGroup) { return(PrtgNodeType.Group); } if (value is IProbe) { return(PrtgNodeType.Probe); } if (value is NotificationTrigger) { return(PrtgNodeType.Trigger); } if (value is PropertyValuePair) { return(PrtgNodeType.Property); } if (value.GetType() == typeof(PrtgObject)) { throw new NotSupportedException($"Cannot process value '{value}' of type '{value.GetType()}': value must be a specific type of {nameof(PrtgObject)}."); } throw new NotImplementedException($"Don't know what type of object '{value}' is."); }
public void OnLevelBegin(ITreeValue value, PrtgNodeType type, int depth) { var typeDescription = IObjectExtensions.GetTypeDescription(value.GetType()); var str = typeDescription.ToLower(); if (value.Id == WellKnownId.Root) { ProgressManager.InitialDescription = "Processing children of 'Root' Group"; } else { ProgressManager.InitialDescription = $"Processing children of {str} '{value}'"; if (value is IPrtgObject) { ProgressManager.InitialDescription += $" (ID: {value.Id})"; } } var activity = depth == 1 ? "PRTG Tree Search" : $"PRTG {typeDescription} Tree Search"; ProgressManager.WriteProgress(activity, $"Retrieving children of {str} '{value}'"); }
internal static PrtgOrphan Object(ITreeValue value, IEnumerable <PrtgOrphan> children) { if (value is Probe) { return(Probe((Probe)value, children)); } if (value is Group) { return(Group((Group)value, children)); } if (value is Device) { return(Device((Device)value, children)); } if (value is Sensor) { return(Sensor((Sensor)value, children)); } if (value is NotificationTrigger) { return(Trigger((NotificationTrigger)value)); } if (value is PropertyValuePair) { return(Property((PropertyValuePair)value)); } throw new NotImplementedException($"Don't know what type of orphan object of type '{value.GetType().FullName}' should be."); }