internal ActionCollection([NotNull] V2Interop.ITaskDefinition iTaskDef)
 {
     v2Def  = iTaskDef;
     v2Coll = iTaskDef.Actions;
     System.Text.RegularExpressions.Match match;
     if (iTaskDef.Data != null && (match = System.Text.RegularExpressions.Regex.Match(iTaskDef.Data, psV2IdRegex)).Success)
     {
         bool on = bool.Parse(match.Groups["v"].Value);
         if (on)
         {
             psConvert |= PowerShellActionPlatformOption.Version2;
         }
         else
         {
             psConvert &= ~PowerShellActionPlatformOption.Version2;
         }
     }
     UnconvertUnsupportedActions();
 }
Beispiel #2
0
        internal virtual void Bind(V2Interop.ITaskDefinition iTaskDef)
        {
            V2Interop.IActionCollection iActions = iTaskDef.Actions;

            switch (this.GetType().Name)
            {
            case "ComHandlerAction":
                iAction = iActions.Create(TaskActionType.ComHandler);
                break;

            case "ExecAction":
                iAction = iActions.Create(TaskActionType.Execute);
                break;

            case "EmailAction":
                iAction = iActions.Create(TaskActionType.SendEmail);
                break;

            case "ShowMessageAction":
                iAction = iActions.Create(TaskActionType.ShowMessage);
                break;

            default:
                throw new ArgumentException();
            }
            Marshal.ReleaseComObject(iActions);
            foreach (string key in unboundValues.Keys)
            {
                try
                {
                    iAction.GetType().InvokeMember(key, System.Reflection.BindingFlags.SetProperty, null, iAction, new object[] { unboundValues[key] });
                }
                catch (System.Reflection.TargetInvocationException tie) { throw tie.InnerException; }
                catch { }
            }
            unboundValues.Clear();
        }
Beispiel #3
0
 /// <summary>
 /// Releases all resources used by this class.
 /// </summary>
 public void Dispose()
 {
     v1Task = null;
     v2Def  = null;
     v2Coll = null;
 }
Beispiel #4
0
 internal ActionCollection(V2Interop.ITaskDefinition iTaskDef)
 {
     v2Def  = iTaskDef;
     v2Coll = iTaskDef.Actions;
 }
 internal ActionCollection(V2Interop.ITaskDefinition iTaskDef)
 {
     v2Def  = iTaskDef;
     v2Coll = iTaskDef.Actions;
     UnconvertUnsupportedActions();
 }