public override void RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; var vAssetName = v_AssetName.ConvertUserVariableToString(engine); var vOutputDirectoryPath = v_OutputDirectoryPath.ConvertUserVariableToString(engine); var client = AuthMethods.GetAuthToken(); var asset = AssetMethods.GetAsset(client, vAssetName, v_AssetType); if (asset == null) { throw new DataException($"No Asset was found for '{vAssetName}' with type '{v_AssetType}'"); } dynamic assetValue; switch (v_AssetType) { case "Text": assetValue = asset.TextValue; break; case "Number": assetValue = asset.NumberValue; break; case "Json": assetValue = asset.JsonValue; break; case "File": var fileID = asset.FileID; File file = FileMethods.GetFile(client, fileID); AssetMethods.DownloadFileAsset(client, asset.Id, vOutputDirectoryPath, file.Name); assetValue = string.Empty; break; default: assetValue = string.Empty; break; } if (v_AssetType != "File") { ((object)assetValue).StoreInUserVariable(engine, v_OutputUserVariableName, nameof(v_OutputUserVariableName), this); } }