Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I solved my own problem, albeit in a crappy way. This is probably incredibly inefficient, but speed isn't a necessity in my particular case. Here is the code that works:</p> <pre><code>Dim strAdd As String = "" For Each t As VisualCronAPI.Server In vcClient.Servers.GetAll() For Each f As VisualCron.JobClass In t.Jobs.GetAll For Each s As VisualCron.TaskClass In f.Tasks Dim propVal As Object Dim propInfo As PropertyInfo() = s.GetType().GetProperties() For i As Integer = 0 To propInfo.Length - 1 With propInfo(i) If s.TaskType.ToString = propInfo(i).Name.ToString Then Dim asm As Assembly = Assembly.Load("VisualCron") Dim typeName As String = String.Format("VisualCron.{0}", propInfo(i).PropertyType.Name) Dim tp As Type = asm.GetType(typeName) Dim construct As ConstructorInfo = tp.GetConstructor(Type.EmptyTypes) Dim classInst As Object = construct.Invoke(Nothing) Dim classProps As PropertyInfo() = classInst.GetType().GetProperties() For h As Integer = 0 To classProps.Length - 1 With classProps(h) If .GetIndexParameters().Length = 0 Then propVal = .GetValue(CallByName(s, propInfo(i).Name.ToString, [Get]), Nothing) If Not propVal Is Nothing Then If propVal.ToString.Contains("\\server\") Or propVal.ToString.Contains("\\SERVER\") Then strAdd = f.Name &amp; " - " &amp; s.Name &amp; " - " &amp; .Name &amp; " - " &amp; propVal.ToString ListBox1.Items.Add(strAdd) End If End If End If End With Next End If End With Next Next s Next f Next t </code></pre> <p>The piece of code that made the difference was the</p> <pre><code>classProps(h).GetValue(CallByName(s, propInfo(i).Name.ToString, [Get]), Nothing) </code></pre> <p>line.</p> <p>If there are any suggestions for improving this code - I'm assuming that I've still got a lot of mistakes in here - then please comment for the future viewers of this answer and so I can adjust my code and learn more about how all of this works.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload