In this Article I'm going to explain how to inspect other Components.
Table of Contents
- List
- Setup
- Simple Component
- Deploy
- Help File
- Logging
- Inputs
- Inspecting other Components (this)
- Creating Globals
- Creating Project Properties
- Working with SQL
- Working with a Web Service
This is a great way to learn how something is done if there isn't documentation or guides you can follow. Dissecting code is a useful skill to obtain.
There are a number of decompilers available, two of which I use are
- dotPeek from JetBrains
- JustDecompile from Telerik
- An SMP staff member told me about ILSpy, I've not tried it yet but useful to add to the list.
Lately I've been favouring JustDecompile over dotPeek but try them out and see which you prefer, or comment below on any others you use and your experience.
For an example we will look at the Add New Data Element, this has a checkbox for Is Array.
The Component Class Name is
LogicBase.Components.Default.Process.InsertDataComponent
So we need to find this DLL.
Open the WF install location and search for
LogicBase.Components.Default*.dll
And it's in
E:\Program Files\Symantec\Workflow\Shared\Components
Copy this to your dev folder. I like to create a folder with WF version numbers.
We need to find the 'InsertDataComponent' under 'Process'.
Now look for the IsArray information.
So we have a declaration.
private bool _array;
Next the Getter/Setter
[HideIfPropertyNull("DataType")]
[PropertyIndex(2)]
[RefreshProperties(RefreshProperties.All)]
public bool IsArray
{
get
{
return this._array;
}
set
{
if (this._array != value)
{
this._array = value;
this.CreateValue();
this.IsValid(true);
}
}
}
Then the methods
ReadFromStream
this._array = info.GetBoolean("isArray");
If we compare this to how I did it in the Checkbox article, this way is more succinct.
this._addSpace = (bool)info.GetValue("_addSpace", typeof(bool), (object)false);
WriteToStream
info.AddValue("isArray", this._array);
We can take what we've learnt here and use it in future components.