Beispiel #1
0
        /// <summary>
        /// Runs 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, System.Collections.Specialized.StringDictionary keyValues, out string output)
        {
            output = string.Empty;

            string url = Params["url"].Value.TrimEnd('/');

            using (SPSite site = new SPSite(url))
                using (SPWeb web = site.AllWebs[Utilities.GetServerRelUrlFromFullUrl(url)])
                {
                    if (Params["treeviewenabled"].UserTypedIn)
                    {
                        web.TreeViewEnabled = bool.Parse(Params["treeviewenabled"].Value);
                    }

                    if (Params["quicklaunchenabled"].UserTypedIn)
                    {
                        web.QuickLaunchEnabled = bool.Parse(Params["quicklaunchenabled"].Value);
                    }

#if MOSS
                    PublishingWeb pubweb = PublishingWeb.GetPublishingWeb(web);
                    if (Params["currentshowsubsites"].UserTypedIn)
                    {
                        pubweb.Navigation.CurrentIncludeSubSites = bool.Parse(Params["currentshowsubsites"].Value);
                    }
                    if (Params["globalshowsubsites"].UserTypedIn)
                    {
                        pubweb.Navigation.GlobalIncludeSubSites = bool.Parse(Params["globalshowsubsites"].Value);
                    }

                    if (Params["currentshowpages"].UserTypedIn)
                    {
                        pubweb.Navigation.CurrentIncludePages = bool.Parse(Params["currentshowpages"].Value);
                    }
                    if (Params["globalshowpages"].UserTypedIn)
                    {
                        pubweb.Navigation.GlobalIncludePages = bool.Parse(Params["globalshowpages"].Value);
                    }

                    OrderingMethod sortMethod = pubweb.Navigation.OrderingMethod;
                    if (Params["sortmethod"].UserTypedIn)
                    {
                        sortMethod = (OrderingMethod)Enum.Parse(typeof(OrderingMethod), Params["sortmethod"].Value, true);
                        pubweb.Navigation.OrderingMethod = sortMethod;
                    }

                    if (sortMethod != OrderingMethod.Manual)
                    {
                        if (Params["autosortmethod"].UserTypedIn)
                        {
                            pubweb.Navigation.AutomaticSortingMethod = (AutomaticSortingMethod)Enum.Parse(typeof(AutomaticSortingMethod), Params["autosortmethod"].Value, true);
                        }
                        if (Params["sortascending"].UserTypedIn)
                        {
                            pubweb.Navigation.SortAscending = bool.Parse(Params["sortascending"].Value);
                        }
                    }
                    else
                    {
                        if (Params["autosortmethod"].UserTypedIn)
                        {
                            Console.WriteLine("WARNING: parameter autosortmethod is incompatible with sortmethod {0}.  The parameter will be ignored.", sortMethod);
                        }
                        if (Params["sortascending"].UserTypedIn)
                        {
                            Console.WriteLine("WARNING: parameter sortascending is incompatible with sortmethod {0}.  The parameter will be ignored.", sortMethod);
                        }
                    }

                    if (Params["inheritglobalnav"].UserTypedIn)
                    {
                        pubweb.Navigation.InheritGlobal = bool.Parse(Params["inheritglobalnav"].Value);
                    }

                    if (Params["currentnav"].UserTypedIn)
                    {
                        CurrentNavSettingsEnum currentNav = (CurrentNavSettingsEnum)Enum.Parse(typeof(CurrentNavSettingsEnum), Params["currentnav"].Value, true);
                        if (currentNav == CurrentNavSettingsEnum.InheritParent)
                        {
                            pubweb.Navigation.InheritCurrent = true;
                            pubweb.Navigation.ShowSiblings   = false;
                        }
                        else if (currentNav == CurrentNavSettingsEnum.CurrentSiteAndSiblings)
                        {
                            pubweb.Navigation.InheritCurrent = false;
                            pubweb.Navigation.ShowSiblings   = true;
                        }
                        else if (currentNav == CurrentNavSettingsEnum.CurrentSiteOnly)
                        {
                            pubweb.Navigation.InheritCurrent = false;
                            pubweb.Navigation.ShowSiblings   = false;
                        }
                    }

                    pubweb.Update();
#else
                    web.Update();
#endif
                }

            return((int)ErrorCodes.NoError);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            OrderingMethod om = new OrderingMethod();

            int[] s;
            int[] temp;

            Stopwatch sw = new Stopwatch();

            for (int i = 2; i < 6; i++)
            {
                s = generateArray((int)Math.Pow(10, i));

                Console.WriteLine("10^" + i + " InsertionSort");
                Console.WriteLine("InDesOrder");
                sw.Start();
                temp = om.insertionSort((int[])s.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();
                Console.WriteLine("InOrder");
                sw.Reset();
                sw.Start();
                temp = om.insertionSort((int[])temp.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();
                Console.WriteLine("Reverse");
                Array.Reverse(temp);
                sw.Reset();
                sw.Start();
                temp = om.insertionSort((int[])temp.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();

                sw.Reset();

                Console.WriteLine("10^" + i + " SelectionSort");
                Console.WriteLine("InDesOrder");
                sw.Start();
                temp = om.selectionSort((int[])s.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();
                Console.WriteLine("InOrder");
                sw.Reset();
                sw.Start();
                temp = om.selectionSort((int[])temp.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();
                Console.WriteLine("Reverse");
                Array.Reverse(temp);
                sw.Reset();
                sw.Start();
                temp = om.selectionSort((int[])temp.Clone());
                sw.Stop();
                Console.Write("Time in seconds: ");
                Console.WriteLine((sw.Elapsed.TotalSeconds));
                Console.WriteLine();
            }

            Console.ReadKey();
        }