/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; using JetBrains.Build.Omea.Util; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace JetBrains.Build.Omea.Infra { /// /// The base class for deriving tasks from it, defines the attribute bag. /// public abstract class TaskBase : Task { #region Data /// /// . /// private readonly Bag myBag = new Bag(); #endregion #region Implementation /// /// Gets the task attributes bag. /// protected Bag Bag { get { return myBag; } } /// /// The method to be overriden in inheriting tasks. /// Throw an exception in case of an errror. /// protected abstract void ExecuteTask(); #endregion #region Overrides /// ///When overridden in a derived class, executes the task. /// /// /// ///true if the task successfully executed; otherwise, false. /// /// public override bool Execute() { try { ExecuteTask(); return true; } catch(Exception ex) { Log.LogError(ex.Message); Log.LogMessage(MessageImportance.Normal, ex.ToString()); return false; } } #endregion } }