Reverse() public method

public Reverse ( ) : void
return void
Beispiel #1
1
        public static void WriteException(System.Exception e)
        {
            ArrayList messages = new ArrayList();
            while (e != null)
            {
                messages.Add(e);
                e = e.InnerException;
            }
            Console.WriteLine(" ");
            Console.WriteLine("------- System.Exception ----------------------------- ");
            messages.Reverse();

            foreach (System.Exception ex in messages)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(" ");
            Console.WriteLine("----- Details -----");
            foreach (System.Exception ex in messages)
            {
                Console.WriteLine("Message..........: " + ex.Message);
                Console.WriteLine("Stact trace......: " + ex.StackTrace);
                Console.WriteLine("TargetSite.......: " + ex.TargetSite.Name);
                Console.WriteLine("Source...........: " + ex.Source);
                Console.WriteLine(" ");
            }
        }
        private void SetBoardList()
        {
            boardlist.Items.Clear();
            studentboardlist.Clear();

            studentboardlist = service.StudentBoardRead();
            studentboardlist.Reverse();
            string[][] array = new string[studentboardlist.Count][];
            string[] boardinfo = new string[6];
            int maxcount = studentboardlist.Count;

            if (studentboardlist.Count >= MaxBoardCount)
            {
                for (int i = 0; i < MaxBoardCount; i++)
                {
                    boardinfo = studentboardlist[i].ToString().Split('\a');

                    array[i] = boardinfo;
                    boardlist.Items.Add(new BoardInfo { Number = maxcount - i, Name = array[i][2], Title = array[i][0], Date = array[i][5] });
                }
            }
            else
            {
                for (int i = 0; i < studentboardlist.Count; i++)
                {
                    boardinfo = studentboardlist[i].ToString().Split('\a');

                    array[i] = boardinfo;
                    boardlist.Items.Add(new BoardInfo { Number = maxcount - i, Name = array[i][2], Title = array[i][0], Date = array[i][5] });
                }
            }
            studentboardlist.Reverse(); //==> 게시판 정보를 빼올때 알맞은놈을 가져오기 위함
        }
        public static void RemoveDuplicatedTokens(ArrayList<ArrayList<QueryToken>> disjuncts)
        {
            IEqualityComparer<string> tokenComparer = new DefaultTokenComparer(DefaultTokenComparer.Options.ConvertUmlauts | DefaultTokenComparer.Options.RemoveDiacritics);

            for (int i = 0; i < disjuncts.Count(); ++i)
            {
                ArrayList<int> tokensToRemove = new ArrayList<int>();
                for (int j = 0; j < disjuncts[i].Count(); ++j)
                {
                    if (!tokensToRemove.Contains(j))
                    {
                        for (int k = j + 1; k < disjuncts[i].Count(); ++k)
                        {
                            if (tokenComparer.Equals(disjuncts[i][j].ToString(), disjuncts[i][k].ToString()))
                                tokensToRemove.Add(k);
                        }
                    }
                }

                tokensToRemove.Sort();
                tokensToRemove.Reverse();

                foreach (var toRemove in tokensToRemove.Distinct()) 
                {
                    disjuncts[i].RemoveAt(toRemove);
                }
            }
        }
        static void Main(string[] args)
        {
            ArrayList al = new ArrayList();

            al.Add(new ShoppinCartItem("Car", 5000));
            al.Add(new ShoppinCartItem("Book", 30));
            al.Add(new ShoppinCartItem("Phone", 80));
            al.Add(new ShoppinCartItem("Computer", 1000));

            al.Sort();

            foreach(ShoppinCartItem item in al)
            {
                Console.WriteLine(item.ItemName + " " + item.Price);
            }

            al.Reverse();

            foreach(ShoppinCartItem item in al)
            {
                Console.WriteLine(item.ItemName + " " + item.Price);
            }

            Console.ReadKey();
        }
            public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success)
            {
                System.Collections.ArrayList arraylist =
                    (System.Collections.ArrayList)((LinkObj <object>)((ASBinCode.rtData.rtObjectBase)thisObj).value).value;

                try
                {
                    arraylist.Reverse();
                    returnSlot.setValue(ASBinCode.rtData.rtUndefined.undefined);
                    success = true;
                }
                //catch (KeyNotFoundException)
                //{
                //    success = false;
                //    stackframe.throwAneException(token, arraylist.ToString() + "没有链接到脚本");
                //}
                catch (ArgumentException a)
                {
                    success = false;
                    stackframe.throwAneException(token,a.Message);
                }
                catch (IndexOutOfRangeException i)
                {
                    success = false;
                    stackframe.throwAneException(token,i.Message);
                }
            }
Beispiel #6
0
    static int Reverse(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.ArrayList)))
            {
                System.Collections.ArrayList obj = (System.Collections.ArrayList)ToLua.ToObject(L, 1);
                obj.Reverse();
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.ArrayList), typeof(int), typeof(int)))
            {
                System.Collections.ArrayList obj = (System.Collections.ArrayList)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                obj.Reverse(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Collections.ArrayList.Reverse"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int Reverse(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
             self.Reverse();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.Reverse(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
		private static IEnumerator Reverse(IEnumerable en)
		{
			var al = new ArrayList();
			foreach (object item in en)
				al.Add(item);
			al.Reverse();
			return al.GetEnumerator();
		}
        public static string GetUrl(XmlNode el, string xpath, XmlNamespaceManager nsMgr, Uri documentUri)
        {
            if (el == null)
                return null;
            XmlNode node = nsMgr == null
                ? el.SelectSingleNode(xpath)
                : el.SelectSingleNode(xpath, nsMgr);
            if (node == null)
                return null;
            string rawUrl = node.Value;
            if (rawUrl == null || rawUrl.Length == 0)
                return null;

            // optimize for common case of absolute path
            if (rawUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
            {
                try
                {
                    return UrlHelper.SafeToAbsoluteUri(new Uri(rawUrl));
                }
                catch { }
            }

            ArrayList ancestors = new ArrayList();

            XmlNode parent = node is XmlAttribute ? ((XmlAttribute)node).OwnerElement : node.ParentNode;
            while (parent != null)
            {
                ancestors.Add(parent);
                parent = parent.ParentNode;
            }

            ancestors.Reverse();

            Uri uri = documentUri;

            foreach (XmlNode anc in ancestors)
            {
                if (anc is XmlElement)
                {
                    XmlElement baseEl = (XmlElement)anc;
                    if (baseEl.HasAttribute("xml:base"))
                    {
                        string thisUri = baseEl.GetAttribute("xml:base");
                        if (uri == null)
                            uri = new Uri(thisUri);
                        else
                            uri = new Uri(uri, thisUri);
                    }
                }
            }

            if (uri == null)
                return UrlHelper.SafeToAbsoluteUri(new Uri(rawUrl));
            else
                return UrlHelper.SafeToAbsoluteUri(new Uri(uri, rawUrl));
        }
Beispiel #10
0
        public void initializePlugins()
        {
            if(_initialized)
            {
                InitializationException ex = new InitializationException();
                ex.reason = "plug-ins already initialized";
                throw ex;
            }

            //
            // Invoke initialize() on the plug-ins, in the order they were loaded.
            //
            ArrayList initializedPlugins = new ArrayList();
            try
            {
                foreach(PluginInfo p in _plugins)
                {
                    try
                    {
                        p.plugin.initialize();
                    }
                    catch(PluginInitializationException ex)
                    {
                        throw ex;
                    }
                    catch(System.Exception ex)
                    {
                        PluginInitializationException e = new PluginInitializationException(ex);
                        e.reason = "plugin `" + p.name + "' initialization failed";
                        throw e;
                    }
                    initializedPlugins.Add(p.plugin);
                }
            }
            catch(System.Exception)
            {
                //
                // Destroy the plug-ins that have been successfully initialized, in the
                // reverse order.
                //
                initializedPlugins.Reverse();
                foreach(Plugin p in initializedPlugins)
                {
                    try
                    {
                        p.destroy();
                    }
                    catch(System.Exception)
                    {
                        // Ignore.
                    }
                }
                throw;
            }

            _initialized = true;
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Basic Array List Testing:");
            ArrayList al = new ArrayList();
            al.Add("Hello");
            al.Add("World");
            al.Add(5);
            al.Add(new FileStream("deleteme", FileMode.Create));

            Console.WriteLine("The array has " + al.Count + " items");

            foreach (object o in al)
            {
                Console.WriteLine(o.ToString());
            }

            Console.WriteLine("\nRemove, Insert and Sort Testing:");
            al = new ArrayList();
            al.Add("Hello");
            al.Add("World");
            al.Add("this");
            al.Add("is");
            al.Add("a");
            al.Add("test");

            Console.WriteLine("\nBefore:");
            foreach (object s in al)
                Console.WriteLine(s.ToString());


            al.Remove("test");
            al.Insert(4, "not");

            al.Sort();

            Console.WriteLine("\nAfter:");
            foreach (object s in al)
                Console.WriteLine(s.ToString());

            al.Sort(new reverseSorter());
            Console.WriteLine("\nReversed:");
            foreach (object s in al)
                Console.WriteLine(s.ToString());

            al.Reverse();
            Console.WriteLine("\nReversed again, different method:");
            foreach (object s in al)
                Console.WriteLine(s.ToString());

            Console.WriteLine("\nBinary Search Example:");
            al = new ArrayList();
            al.AddRange(new string[] { "Hello", "World", "this", "is", "a", "test" });
            foreach (object s in al)
                Console.Write(s + " ");
            Console.WriteLine("\n\"this\" is at index: " + al.BinarySearch("this"));
        }
		public void TestSort()
		{
			ArrayList anArrayList = new ArrayList (){ 1, 2, 3 };	
		
			anArrayList.Sort ();
			Assert.AreEqual (1, anArrayList [0]);

			anArrayList.Reverse ();
			Assert.AreEqual (3, anArrayList [0]);
		}
Beispiel #13
0
 private void LoadNam()
 {
     ArrayList nams = new ArrayList();
     for (int i = 1900; i <= DateTime.Today.Year; ++i)
     {
         nams.Add(i);
     }
     nams.Reverse();
     cbxNam.DataSource = nams;
     cbxNam.SelectedIndex = 0;
 }
Beispiel #14
0
	public ArrayList pop_all_since_marker() {
		ArrayList result = new ArrayList();
		object o = pop();
		while (o != this.MARKER) {
			result.Add(o);
			o = pop();
		}
		result.TrimToSize();
		result.Reverse();
		return result;
	}
Beispiel #15
0
 static public int Reverse(IntPtr l)
 {
     try {
         System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
         self.Reverse();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        /// <summary>
        /// Processes a list of source items and returns a result.
        /// </summary>
        /// <param name="source">
        /// The source list to process.
        /// </param>
        /// <param name="args">
        /// An optional processor arguments array.
        /// </param>
        /// <returns>
        /// The processing result.
        /// </returns>
        public object Process(ICollection source, object[] args)
        {
            if (source == null || source.Count == 0)
            {
                return source;
            }

            ArrayList list = new ArrayList(source);
            list.Reverse();

            return list;            
        }
 private void AddWebParts(ArrayList webParts, WebPartZoneBase zone)
 {
     webParts.Reverse();
     foreach (WebPart part in webParts)
     {
         WebPartZoneBase base2 = zone;
         if (!part.AllowZoneChange && (part.Zone != null))
         {
             base2 = part.Zone;
         }
         base.WebPartManager.AddWebPart(part, base2, 0);
     }
 }
Beispiel #18
0
        protected override IList GetChildren(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            Stack stack = obj as Stack;
            if (stack == null)
                throw new Exception(string.Format("The type of obj is not {0}", typeof(Stack).FullName));

            ArrayList arrayList = new ArrayList(stack.ToArray());
            arrayList.Reverse();
            return arrayList;
        }
Beispiel #19
0
 //////////////////////////////////////////////////////////////////////////////////
 public ArrayList GetAncestors(String id)
 {
     ArrayList ans = new ArrayList();
     while (true)
     {
         Hashtable parentNode = GetParentNode(id);
         if (parentNode == null) break;
         ans.Add(parentNode);
         id = Convert.ToString(parentNode[pidField]);
     }
     ans.Reverse();
     return ans;
 }
        static void reversearraylist()
        {
            ArrayList list = new ArrayList();
            list.Add ("amardeep");
            list.Add("raja");

            list.Reverse();

            foreach(string s in list) {

                Console.WriteLine("the reversed array is :"  + "  "+ s);
            }
        }
Beispiel #21
0
        public UInt32[] ReturnArray()
        {
            UInt32[] uptime_array = { 0, 0, 0, 0, 0 };
            ArrayList uptime_list = new ArrayList(5);
            FileStream fp;
            string line;
            try
            {

                fp = new FileStream("F:/LiveProjects/C#Rookie/Uptime_history.txt", FileMode.Open, FileAccess.Read);
            }
            catch (IOException)
            {
                Console.WriteLine("No history file, returning empty array");
                return uptime_array;
            }

            StreamReader sr = new StreamReader(fp);

            while ((line = sr.ReadLine()) != null)
            {
                uptime_list.Add(line);

            }
            fp.Close();

            uptime_list.Reverse();
            if (uptime_list.Count > 5)
            {
                //we are interested in only the last 5 entries
                for (int z = 0; z < 5; z++)
                {
                    uptime_array[z] = Convert.ToUInt32(uptime_list[z]);
                }
            }

            else if (uptime_list.Count < 5)
            {
                for (int z = 0; z < uptime_list.Count; z++)
                {
                    uptime_array[z] = Convert.ToUInt32(uptime_list[z]);
                }
            }

            for (int z = 0; z < 5; z++)
            {
                Console.WriteLine("reversed contents = " + uptime_array[z]);
            }

            return uptime_array;
        }
Beispiel #22
0
        public static Report CompileFactionLeaderboard()
        {
            Report report = new Report( "Faction Leaderboard", "60%" );

            report.Columns.Add( "28%", "center", "Name" );
            report.Columns.Add( "28%", "center", "Faction" );
            report.Columns.Add( "28%", "center", "Office" );
            report.Columns.Add( "16%", "center", "Kill Points" );

            ArrayList list = new ArrayList();

            List<Faction> factions = Faction.Factions;

            for ( int i = 0; i < factions.Count; ++i )
            {
                Faction faction = factions[i];

                list.AddRange( faction.Members );
            }

            list.Sort();
            list.Reverse();

            for ( int i = 0; i < list.Count && i < 15; ++i )
            {
                PlayerState pl = (PlayerState)list[i];

                string office;

                if ( pl.Faction.Commander == pl.Mobile )
                    office = "Commanding Lord";
                else if ( pl.Finance != null )
                    office = String.Format( "{0} Finance Minister", pl.Finance.Definition.FriendlyName );
                else if ( pl.Sheriff != null )
                    office = String.Format( "{0} Sheriff", pl.Sheriff.Definition.FriendlyName );
                else
                    office = "";

                ReportItem item = new ReportItem();

                item.Values.Add( pl.Mobile.Name );
                item.Values.Add( pl.Faction.Definition.FriendlyName );
                item.Values.Add( office );
                item.Values.Add( pl.KillPoints.ToString(), "N0" );

                report.Items.Add( item );
            }

            return report;
        }
        public void AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode node = e.Node;
            ArrayList list = new ArrayList();
            while (node.Parent != null)
            {
                list.Add(node.Parent.Nodes.IndexOf(node));
                node = node.Parent;
            }
            list.Add(((TreeView) sender).Nodes.IndexOf(node));
            list.Reverse();

            Listener.FireEvent(TesterType, sender, new EventAction("SelectNode", list.ToArray(typeof (object))));
        }
Beispiel #24
0
 private static string makeString(ICollection c)
 {
     StringBuilder sb = new StringBuilder();
     ArrayList list = new ArrayList(c);
     list.Sort();
     list.Reverse();
     for (int i = 0; i < list.Count; i++)
     {
         if (i>0) sb.Append(", ");
         object o = list[i];
         sb.Append(o.ToString());
     }
     return sb.ToString();
 }
        private static ISelection ReverseSelection(ISelection selection)
        {
            ArrayList list = new ArrayList();

            if (selection != null && selection.Items != null)
            {
                foreach (object o in selection.Items)
                    list.Add(o);

                list.Reverse();
            }

            return new Selection(list);
        }
Beispiel #26
0
        // Compare guess and Jumbled Number
        // Returns number of correct digits
        public int CompareGuessandNumJum(JumbledNumber NumJumObj)
        {
            long currGuess,
                currNumJum;

            int numDigits,
                numCorrect = 0,
                gint,
                njint;

            // Get values form NumJum Object
            currGuess = NumJumObj.CurGuess;
            currNumJum = NumJumObj.JNumberValue;
            numDigits = NumJumObj.NumDigits;

            ArrayList guessArray = new ArrayList(),
                numJumArray = new ArrayList();

            // Build array for both the guess and the NumJum for comparison

            for (int i = 0; i < numDigits; i++)
            {
                guessArray.Add((int)(currGuess % 10));
                numJumArray.Add((int)(currNumJum % 10));

                currGuess = (currGuess / 10);
                currNumJum = (currNumJum / 10);
            }

            // Reverse arrays to get in correct order
            guessArray.Reverse();
            numJumArray.Reverse();

            // Use for loops and if statements to compare values

            for (int i = 0; i < numDigits; i++)
            {
                // Use CompareTo method to determine if values are the same
                gint = (int)guessArray[i];
                njint = (int)numJumArray[i];

                if ((gint.CompareTo(njint) == 0))
                {
                    numCorrect++;
                }
            }

            return numCorrect;
        }
Beispiel #27
0
 public void GetRecent(string groupId)
 {
     CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
     CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
     CloudTable table = tableClient.GetTableReference("roomchat");
     table.CreateIfNotExists();
     TableQuery<RoomChatEntity> query = new TableQuery<RoomChatEntity>().Where(TableQuery.GenerateFilterCondition("RoomId", QueryComparisons.Equal, groupId)).Take(20); ;
     ArrayList entities = new ArrayList();
     foreach (RoomChatEntity en in table.ExecuteQuery(query))
     {
         entities.Add(en);
     }
     entities.Reverse();
     Clients.Caller.LoadRecent(groupId, entities);
 }
Beispiel #28
0
 public static void Check(BPlusTreeLong bpt)
 {
     Console.WriteLine(bpt.ToText());
       bpt.CheckFreeBlock();
       ArrayList allkeys = new ArrayList();
       foreach (DictionaryEntry d in AllInsertHashtable)
       {
     allkeys.Add(d.Key);
       }
       allkeys.Sort();
       allkeys.Reverse();
       foreach (object thing in allkeys)
       {
     string thekey = (string)thing;
     long thevalue = (long)AllInsertHashtable[thing];
     if (thevalue != bpt[thekey])
     {
       throw new ApplicationException("no match on retrieval " + thekey + " --> " + bpt[thekey] + " not " + thevalue);
     }
       }
       allkeys.Reverse();
       string currentkey = bpt.FirstKey();
       foreach (object thing in allkeys)
       {
     string testkey = (string)thing;
     if (currentkey == null)
     {
       throw new ApplicationException("end of keys found when expecting " + testkey);
     }
     if (!testkey.Equals(currentkey))
     {
       throw new ApplicationException("when walking found " + currentkey + " when expecting " + testkey);
     }
     currentkey = bpt.NextKey(testkey);
       }
 }
Beispiel #29
0
        static void Main(string[] args)
        {
            ArrayList shoppingCart = new ArrayList();
            shoppingCart.Add(new ShoppingCartItem("Car", 5000));
            shoppingCart.Add(new ShoppingCartItem("Book", 30));
            shoppingCart.Add(new ShoppingCartItem("Phone", 80));
            shoppingCart.Add(new ShoppingCartItem("Computer", 1000));

            printCart(shoppingCart);

            Console.WriteLine("Sorting...");
            shoppingCart.Sort();
            shoppingCart.Reverse();
            printCart(shoppingCart);
        }
Beispiel #30
0
 //清空游戏元素对应的图片
 public void clearAll()
 {
     ArrayList indexs = new ArrayList();
     foreach(Control item in Controls)
     {
         if (item.GetType().Name.Equals("PictureBox"))
         {
             indexs.Add(Controls.IndexOf(item));
         }
     }
     indexs.Reverse();
     foreach(int index in indexs)
     {
         Controls.RemoveAt(index);
     }
 }
Beispiel #31
0
 static public int Reverse__Int32__Int32(IntPtr l)
 {
     try {
         System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.Reverse(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        internal static void FetchAttendees(User i_LoggedInUser, ListBox i_ListBoxFriendsWithRank)
        {
            List<UserRank<Event>> allUsersWithSharedEvents = CentralSingleton.Instance.AttendeesFromEventListAdapter.UserRankList;
            if (allUsersWithSharedEvents == null)
            {
                allUsersWithSharedEvents = FetchAttendeesFromEvents(i_LoggedInUser);
                CentralSingleton.Instance.AttendeesFromEventListAdapter.UserRankList = allUsersWithSharedEvents;
            }

            ArrayList userRankList = new ArrayList(allUsersWithSharedEvents);
            userRankList.Sort();
            userRankList.Reverse();
            foreach (UserRank<Event> userRank in userRankList)
            {
                i_ListBoxFriendsWithRank.Invoke(new Action(() => i_ListBoxFriendsWithRank.Items.Add(userRank)));
            }
        }
Beispiel #33
0
		string MakeLinkPath(IDirectory directory, HttpRequest request)
		{
			StringBuilder sb = new StringBuilder();
			ArrayList pathList = new ArrayList();

			for(IDirectory dir = directory; dir != null; dir = dir.Parent)
				pathList.Add(dir.Name);

			pathList.RemoveAt(pathList.Count-1);

			pathList.Reverse();

			sb.Append("<a href=\"" + request.Uri.Scheme + "://" + request.Uri.Host);
			if(request.Uri.Port != 80)
				sb.Append(":" + request.Uri.Port);
			sb.Append("/\">");
			sb.Append(request.Uri.Host + "</a>");

			if(pathList.Count > 0)
				sb.Append(" - ");

			StringBuilder reassembledPath = new StringBuilder();

			for(int i = 0; i < pathList.Count; i++)
			{
				string path = pathList[i] as string;

				sb.Append("<a href=\"/");

				reassembledPath.Append(UrlEncoding.Encode(path));
				reassembledPath.Append("/");

				sb.Append(reassembledPath.ToString());

				sb.Append("\">");

				sb.Append(path);

				if(i < pathList.Count-1)
					sb.Append("</a>/");
				else
					sb.Append("</a>");
			}

			return sb.ToString();
		}
        static void Main(string[] args)
        {
            ArrayList myArrayList = new ArrayList();

            myArrayList.Add(10);
            myArrayList.Add(20);
            myArrayList.Add(94);

            //myArrayList.Sort();
            myArrayList.Reverse();

            for (int i = 0; i < myArrayList.Count; i++)
            {
                Console.WriteLine(myArrayList[i]);
            }

            Console.ReadKey();
        }
Beispiel #35
0
        public static void WriteBoxBorder(HtmlTextWriter writer, string classBorder)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, classBorder);
            writer.RenderBeginTag(HtmlTextWriterTag.B);

            ArrayList borders = new ArrayList(_borders);
            if(classBorder.Equals("xbottom"))
                borders.Reverse();

            foreach (string border in borders)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, border);
                writer.RenderBeginTag(HtmlTextWriterTag.B);
                writer.RenderEndTag();
            }

            writer.RenderEndTag();
        }
Beispiel #36
0
 private void Current_RenderFrame_Sort(object sender, EventArgs e)
 {
     try
     {
         if (CURRENT_STATE == State.IDLE)
         {
             CoreManager.Current.RenderFrame -= new EventHandler <EventArgs>(Current_RenderFrame_Sort);
         }
         else if (CURRENT_STATE == State.INITIATED)
         {
             bool identifying = false;
             MainView.prgProgressBar.Max     = sortList.Count;
             MainView.prgProgressBar.PreText = "identifying...";
             foreach (WorldObject obj in sortList)
             {
                 if (!obj.HasIdData)
                 {
                     identifying = true;
                     MainView.prgProgressBar.Position = sortList.IndexOf(obj) + 1;
                     break;
                 }
             }
             if (!identifying)
             {
                 CURRENT_STATE = State.BUILDING_LIST;
                 MainView.prgProgressBar.Position = MainView.prgProgressBar.Max;
             }
         }
         else if (CURRENT_STATE == State.BUILDING_LIST)
         {
             String[] sortKeys = MainView.edtSortString.Text.Split(',');
             System.Collections.ArrayList sortValueList = new System.Collections.ArrayList();
             for (int i = sortKeys.Length - 1; i >= 0; i--)
             {
                 foreach (WorldObject worldObject in sortList)
                 {
                     SortFlag sf         = SortFlag.decode(sortKeys[i]);
                     String   sortMetric = sf.valueOf(worldObject);
                     if (!sortValueList.Contains(sortMetric))
                     {
                         sortValueList.Add(sortMetric);
                     }
                 }
                 sortValueList.Sort(new AlphanumComparator());
                 System.Collections.ArrayList newSortList = new System.Collections.ArrayList();
                 if (!(sortKeys[i].Length == 3 && sortKeys[i].Substring(2, 1).Equals("-")))
                 {
                     sortValueList.Reverse();
                 }
                 foreach (Object sortValue in sortValueList)
                 {
                     foreach (WorldObject worldObject in sortList)
                     {
                         String sortMetric = SortFlag.decode(sortKeys[i]).valueOf(worldObject);
                         if (sortMetric.Equals(sortValue))
                         {
                             newSortList.Add(worldObject);
                         }
                     }
                 }
                 sortList = newSortList;
                 if (i == 0)
                 {
                     if (Properties.Settings.Default.ReverseSortList)
                     {
                         sortList.Reverse();
                     }
                     foreach (WorldObject worldObject in sortList)
                     {
                         sortQueue.Enqueue(worldObject);
                     }
                 }
             }
             Util.WriteToChat(sortQueue.Count + " items in queue...");
             CURRENT_STATE = State.MOVING_ITEMS;
             MainView.prgProgressBar.PreText = "working...";
             MainView.prgProgressBar.Max     = sortQueue.Count;
         }
         else if (CURRENT_STATE == State.MOVING_ITEMS)
         {
             if (sortQueue.Count > 0)
             {
                 if (Core.Actions.BusyState == 0)
                 {
                     MainView.prgProgressBar.Position = MainView.prgProgressBar.Max - sortQueue.Count;
                     WorldObject obj = (WorldObject)sortQueue.Dequeue();
                     if (containerDest != Core.CharacterFilter.Id && Core.WorldFilter[containerDest].ObjectClass.Equals(ObjectClass.Player))
                     {
                         Globals.Host.Actions.GiveItem(obj.Id, containerDest);
                     }
                     else
                     {
                         Globals.Host.Actions.MoveItem(obj.Id, containerDest, containerDestSlot, true);
                     }
                 }
             }
             else
             {
                 CURRENT_STATE = State.IDLE;
                 MainView.prgProgressBar.PreText  = "done!";
                 MainView.prgProgressBar.Position = MainView.prgProgressBar.Max;
                 MainView.btnActivate.Text        = "Activate";
                 Util.WriteToChat("done sorting items!");
             }
         }
     }
     catch (Exception ex) { Util.LogError(ex); }
 }