Beispiel #1
0
void FriendListManager :: LoadNetworkData(void)
{
	if(networkDataFile.size() == 0)
	{
		g_Log.AddMessageFormat("Network Cache filename not set.");
		return;
	}
	FileReader lfr;
	if(lfr.OpenText(networkDataFile.c_str()) != Err_OK)
	{
		g_Log.AddMessageFormat("Error opening Network Cache file for reading: %s", networkDataFile.c_str());
		return;
	}

	lfr.CommentStyle = Comment_Semi;
	while(lfr.FileOpen() == true)
	{
		lfr.ReadLine();
		int r = lfr.MultiBreak("=,");
		if(r >= 2)
		{
			int sourceDefID = lfr.BlockToIntC(0);
			std::vector<int> &ref = networkData[sourceDefID];
			for(int i = 1; i < r; i++)
				ref.push_back(lfr.BlockToIntC(i));
		}
	}
	lfr.CloseCurrent();
}
Beispiel #2
0
void IGFThreadPage :: LoadFile(const char *filename)
{
	FileReader lfr;
	if(lfr.OpenText(filename) != Err_OK)
	{
		g_Logs.data->error("IGFThreadPage::LoadFile failed to open file.");
		return;
	}
	lfr.CommentStyle = Comment_Semi;
	IGFThread entry;

	while(lfr.FileOpen() == true)
	{
		lfr.ReadLine();
		int r = lfr.BreakUntil("=", '=');
		if(r > 0)
		{
			lfr.BlockToStringC(0, 0);
			if(strcmp(lfr.SecBuffer, "[ENTRY]") == 0)
			{
				if(entry.mID != 0)
					InsertEntry(entry, false);
				entry.Clear();
			}
			else if(strcmp(lfr.SecBuffer, "ID") == 0)
				entry.mID = lfr.BlockToIntC(1);
			else if(strcmp(lfr.SecBuffer, "Title") == 0)
				entry.mTitle = lfr.BlockToStringC(1, 0);
			else if(strcmp(lfr.SecBuffer, "CreationAccount") == 0)
				entry.mCreationAccount = lfr.BlockToIntC(1);
			else if(strcmp(lfr.SecBuffer, "CreationTime") == 0)
				entry.mCreationTime = lfr.BlockToStringC(1, 0);
			else if(strcmp(lfr.SecBuffer, "CreatorName") == 0)
				entry.mCreatorName = lfr.BlockToStringC(1, 0);
			else if(strcmp(lfr.SecBuffer, "ParentCategory") == 0)
				entry.mParentCategory = lfr.BlockToIntC(1);
			else if(strcmp(lfr.SecBuffer, "Locked") == 0)
				entry.mLocked = lfr.BlockToBoolC(1);
			else if(strcmp(lfr.SecBuffer, "Stickied") == 0)
				entry.mStickied = lfr.BlockToBoolC(1);
			else if(strcmp(lfr.SecBuffer, "Flags") == 0)
				entry.mFlags.setraw(lfr.BlockToIntC(1));
			else if(strcmp(lfr.SecBuffer, "LastUpdateTime") == 0)
				entry.mLastUpdateTime = lfr.BlockToULongC(1);
			else if(strcmp(lfr.SecBuffer, "PostList") == 0)
			{
				r = lfr.MultiBreak("=,");
				for(int i = 1; i < r; i++)
					entry.mPostList.push_back(lfr.BlockToIntC(i));
			}
			else
				g_Logs.data->warn("IGFThreadPage::LoadFile unknown identifier [%v] in file [%v] on line [%v]", lfr.SecBuffer, filename, lfr.LineNumber);
		}
	}
	if(entry.mID != 0)
		InsertEntry(entry, false);
	lfr.CloseCurrent();
}