예제 #1
0
        /// <summary>
        /// Executes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="keyValues">The key values.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public override int Execute(string command, StringDictionary keyValues, out string output)
        {
            output         = string.Empty;
            Logger.Verbose = true;

            ActivationScope scope = ActivationScope.Feature;

            if (Params["scope"].UserTypedIn)
            {
                scope = (ActivationScope)Enum.Parse(typeof(ActivationScope), Params["scope"].Value.ToLowerInvariant(), true);
            }

            bool force           = Params["force"].UserTypedIn;
            bool ignoreNonActive = Params["ignorenonactive"].UserTypedIn;

            if (ignoreNonActive)
            {
                force = true;
            }

            string url = null;

            if (Params["url"].UserTypedIn)
            {
                url = Params["url"].Value.TrimEnd('/');
            }

            try
            {
                Logger.Write("Started at {0}", DateTime.Now.ToString());
                Guid          featureId = FeatureHelper.GetFeatureIdFromParams(Params);
                FeatureHelper fh        = new FeatureHelper();
                fh.ActivateDeactivateFeatureAtScope(scope, featureId, false, url, force, ignoreNonActive);
            }
            finally
            {
                Logger.Write("Finished at {0}\r\n", DateTime.Now.ToString());
            }

            return((int)ErrorCodes.NoError);
        }