/// <summary> /// Process for specified event. /// </summary> /// <param name="evt">Configured event.</param> /// <returns>Result of handling.</returns> public override bool process(ISolutionEvent evt) { IModeEnvCommand mode = (IModeEnvCommand)evt.Mode; if(mode.Command == null || mode.Command.Length < 1) { return true; } if(!evt.SupportMSBuild && !evt.SupportSBEScripts) { return raise(mode.Command, mode.AbortOnFirstError); } var parsed = new CommandDte[mode.Command.Length]; for(int i = 0; i < mode.Command.Length; ++i) { parsed[i] = new CommandDte() { Guid = parse(evt, mode.Command[i].Guid), Id = mode.Command[i].Id, CustomIn = parse(mode.Command[i].CustomIn, evt), CustomOut = parse(mode.Command[i].CustomOut, evt) }; } return raise(parsed, mode.AbortOnFirstError); }
protected void setCommandDte(CommandDte[] commands) { dgvEnvCmd.Rows.Clear(); if(commands == null) { return; } foreach(CommandDte c in commands) { dgvEnvCmd.Rows.Add(c.Guid, c.Id, Value.pack(c.CustomIn), Value.pack(c.CustomOut)); } }
/// <summary> /// Raise commands for EnvDTE. /// </summary> /// <param name="commands">Atomic DTE-commands for handling.</param> /// <pparam name="abortOnFirstError">Abort commands on first error if true.</pparam> /// <returns>true value if all raised without errors.</returns> protected bool raise(CommandDte[] commands, bool abortOnFirstError) { bool success = true; foreach(CommandDte c in commands) { object cin = c.CustomIn; object cout = c.CustomOut; try { cmd.Env.raise(c.Guid, c.Id, ref cin, ref cout); } catch(Exception ex) { Log.Warn("Action-EnvCommand: problem with command: '{0}', '{1}' :: '{2}'", c.Guid, c.Id, ex.Message); if(abortOnFirstError) { return false; } success = false; } } return success; }
/// <param name="command"></param> public ModeEnvCommand(CommandDte[] command) { Command = command; }