UBrowser
Class UBrowserFavoritesFact

source: c:\runehov\UBrowser\Classes\UBrowserFavoritesFact.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowList
         |
         +--UBrowser.UBrowserServerListFactory
            |
            +--UBrowser.UBrowserFavoritesFact
Direct Known Subclasses:None

class UBrowserFavoritesFact
extends UBrowser.UBrowserServerListFactory


Variables
 int FavoriteCount
 string Favorites[100]


Function Summary
 string ParseOption(string Input, int Pos)
     
/* eg Favorites[0]=Host Name\10.0.0.1\7778\True */
 void Query(optional bool, optional bool)
 void SaveFavorites()



Source Code


00001	class UBrowserFavoritesFact extends UBrowserServerListFactory;
00002	
00003	var config int FavoriteCount;
00004	var config string Favorites[100];
00005	
00006	/* eg Favorites[0]=Host Name\10.0.0.1\7778\True */
00007	
00008	
00009	function string ParseOption(string Input, int Pos)
00010	{
00011		local int i;
00012	
00013		while(True)
00014		{
00015			if(Pos == 0)
00016			{
00017				i = InStr(Input, "\\");
00018				if(i != -1)
00019					Input = Left(Input, i);
00020				return Input;
00021			}
00022	
00023			i = InStr(Input, "\\");
00024			if(i == -1)
00025				return "";
00026	
00027			Input = Mid(Input, i+1);
00028			Pos--;
00029		}
00030	}
00031	
00032	function Query(optional bool bBySuperset, optional bool bInitial)
00033	{
00034		local int i;
00035		local UBrowserServerList L;
00036	
00037		Super.Query(bBySuperset, bInitial);
00038	
00039		for(i=0;i<FavoriteCount;i++)
00040		{
00041			L = FoundServer(ParseOption(Favorites[i], 1), Int(ParseOption(Favorites[i], 2)), "", "Rune", ParseOption(Favorites[i], 0));
00042			L.bKeepDescription = ParseOption(Favorites[i], 3) ~= (string(True));
00043		}
00044	
00045		QueryFinished(True);
00046	}
00047	
00048	function SaveFavorites()
00049	{
00050		local UBrowserServerList I;
00051	
00052		FavoriteCount = 0;
00053		for(I = UBrowserServerList(PingedList.Next); i!=None; I = UBrowserServerList(I.Next))
00054		{
00055			if(FavoriteCount == 100)
00056				break;
00057			Favorites[FavoriteCount] = I.HostName$"\\"$I.IP$"\\"$string(I.QueryPort)$"\\"$string(I.bKeepDescription);
00058	
00059			FavoriteCount++;
00060		}
00061	
00062		for(I = UBrowserServerList(UnPingedList.Next); i!=None; I = UBrowserServerList(I.Next))
00063		{
00064			if(FavoriteCount == 100)
00065				break;
00066			Favorites[FavoriteCount] = I.HostName$"\\"$I.IP$"\\"$string(I.QueryPort)$"\\"$string(I.bKeepDescription);
00067	
00068			FavoriteCount++;
00069		}
00070	
00071		if(FavoriteCount < 100)
00072			Favorites[FavoriteCount] = "";
00073	
00074		SaveConfig();
00075	}
00076	
00077	defaultproperties
00078	{
00079	     FavoriteCount=7
00080	     Favorites(0)="Low Caliber Cycle\208.254.40.162\7778\False"
00081	     Favorites(1)="Low Caliber Arena\208.254.40.150\7778\False"
00082	     Favorites(2)="welcome to the dbw server\24.193.45.211\7778\False"
00083	     Favorites(3)="1on1/FFA Arena Server - By Darth and Rage\204.130.224.13\7778\False"
00084	     Favorites(4)="secretlabs\24.185.207.225\7778\False"
00085	     Favorites(5)="International House Of BIWS\65.80.230.12\7778\False"
00086	     Favorites(6)="Dot Cafe's House of Pain \192.168.1.100\7778\False"
00087	}

End Source Code