UBrowser
Class UBrowserFavoritesFact

source: e:\games\UnrealTournament\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)), "", "Unreal", 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	}

End Source Code