コード例 #1
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void FunctionModifierNode::PrintXml(opXmlStream& stream)
{
	opXmlTag notetag(stream,"Modifier");
	
	{
		opXmlTextTag nametag(stream,"Name");
		stream << Name->GetValue();
	}

	{
		opXmlTextTag nametag(stream,"Type");
		stream << "Function";

	}

	if(Arguments)
	{
		opXmlTextTag valuetag(stream,"Value");

		if(TerminalNode* condition = Arguments->GetCondition())
			stream << condition->GetValue();
	}

	PrintXmlChildren(stream);
}
コード例 #2
0
ファイル: Friend.cpp プロジェクト: BackupTheBerlios/nextemf
void CFriend::WriteToFile(CFileDataIO* file)
{
	if (!m_dwHasHash)
		md4cpy(m_abyUserhash, sm_abyNullHash);
	file->WriteHash16(m_abyUserhash);
	file->WriteUInt32(m_dwLastUsedIP);
	file->WriteUInt16(m_nLastUsedPort);
	file->WriteUInt32(m_dwLastSeen);
	file->WriteUInt32(m_dwLastChatted);

	uint32 uTagCount = 0;
	ULONG uTagCountFilePos = (ULONG)file->GetPosition();
	file->WriteUInt32(uTagCount);

	if (!m_strName.IsEmpty()){
		if (WriteOptED2KUTF8Tag(file, m_strName, FF_NAME))
			uTagCount++;
		CTag nametag(FF_NAME, m_strName);
		nametag.WriteTagToFile(file);
		uTagCount++;
	}

	file->Seek(uTagCountFilePos, CFile::begin);
	file->WriteUInt32(uTagCount);
	file->Seek(0, CFile::end);
}
コード例 #3
0
ファイル: Friend.cpp プロジェクト: HackLinux/eMule-IS-Mod
void CFriend::WriteToFile(CFileDataIO* file)
{
	file->WriteHash16(m_abyUserhash);
	file->WriteUInt32(m_dwLastUsedIP);
	file->WriteUInt16(m_nLastUsedPort);
	file->WriteUInt32(ConvertToTime32(m_dwLastSeen));
	file->WriteUInt32(m_dwLastChatted);

	uint32_t uTagCount = 0;
	ULONG uTagCountFilePos = (ULONG)file->GetPosition();
	file->WriteUInt32(uTagCount);

	if (!m_strName.IsEmpty()){
		CTag nametag(FF_NAME, m_strName);
		nametag.WriteTagToFile(file, utf8strOptBOM);
		uTagCount++;
	}
	if (HasKadID()){
		CTag tag(FF_KADID, (const BYTE*)m_abyKadID);
		tag.WriteNewEd2kTag(file);
		uTagCount++;
	}

	file->Seek(uTagCountFilePos, CFile::begin);
	file->WriteUInt32(uTagCount);
	file->Seek(0, CFile::end);
}
コード例 #4
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void EnumerationNode::PrintXml(opXmlStream& stream)
{
	opXmlTag notetag(stream,"Enumeration");
	
	{
		opXmlTextTag nametag(stream,"Name");
		stream << Name->GetValue();
	}
	
	PrintXmlChildren(stream);	
}
コード例 #5
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void DisallowNode::PrintXml(opXmlStream& stream)
{
	opXmlTag disallowtag(stream,"Disallow");
	
	{
		opXmlTextTag nametag(stream,"Name");
		stream << Name->GetValue();
	}
	
	PrintXmlChildren(stream);
}
コード例 #6
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void CategoryNode::PrintXml(opXmlStream& stream)
{
	opXmlTag categorytag(stream,"Category");

	{
		opXmlTextTag nametag(stream, "Name");
		stream << Name->GetValue();
	}

	PrintXmlChildren(stream);
}
コード例 #7
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void LocationNodeBase::PrintXml(opXmlStream& stream)
{
	opXmlTag locationtag(stream,"Location");

	{
		opXmlTextTag nametag(stream,"Name");
		stream << Name->GetStringValue();
	}

	PrintXmlChildren(stream);
}
コード例 #8
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void DialectNote::PrintXml(opXmlStream& stream)
{
	{
		opXmlTextTag nametag(stream,"Name");
		stream << GetName();
	}

	if(GetNoteDefinition() && GetNoteDefinition()->GetFile())
	{
		{
			opXmlTextTag pathtag(stream,"Path");
			stream << GetNoteDefinition()->GetFile()->GetInputName();
		}

		{
			opXmlTextTag linetag(stream,"Line");
			stream << opString(GetNoteDefinition()->GetLine());
		}
	}

	//print all arguments
	vector<opString> arguments;
	BuildValidArguments(arguments);
	
	//opXmlTag argumentstag(stream,"Arguments");
	
	int num = (int)arguments.size();
	for(int i = 0; i < num; i++)
	{
		opXmlTag argument(stream,"Argument");
		
		{
			opXmlTextTag name(stream,"Name");
			stream << arguments[i];
		}

		opString description;
		//NOTE: needs to only look at valued modifiers!
		//		and arguments...
		if(GetArgumentDescription(arguments[i],description))
		{
			opXmlTextTag d(stream,"Description");
			stream << description;
		}

	}
}
コード例 #9
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void DialectEnumMap::PrintXml(opXmlStream& stream)
{
	{
		opXmlTextTag nametag(stream,"Name");
		stream << GetName();
	}
	
	{
		opXmlTextTag typetag(stream,"Type");

		stream << "Enum";
	}
	
	//print all notes
	StartNote.PrintXml(stream);
	NameNote.PrintXml(stream);
	ValueNote.PrintXml(stream);
	EndNote.PrintXml(stream);
}
コード例 #10
0
ファイル: print_dialect.cpp プロジェクト: TwinsenEd/opcpp
void DialectMap::PrintXml(opXmlStream& stream)
{
	{
		opXmlTextTag nametag(stream,"Name");
		stream << GetName();
	}

	{
		opXmlTextTag typetag(stream,"Type");

		if(Mode == DataMap)
			stream << "Data";
		else if(Mode == FunctionMap)
			stream << "Function";
	}
	
	//print all notes
	StartNote.PrintXml(stream);
	MappingNote.PrintXml(stream);
	EndNote.PrintXml(stream);
}
コード例 #11
0
ファイル: npc.cpp プロジェクト: archlo/journey_client
	npc::npc(int id, int o, bool fr, short f, vector2d pos)
	{
		app.getimgcache()->setmode(ict_map);
		nx::view_file("Npc");

		string fullname;
		string strid = to_string(id);
		size_t extend = 7 - strid.length();
		for (char i = 0; i < extend; i++)
		{
			fullname.append("0");
		}
		fullname.append(strid);
		node npcdata = nx::nodes["Npc"].resolve(fullname + ".img");

		map<string, vector<string>> linenames;
		for (node npcnode = npcdata.begin(); npcnode != npcdata.end(); npcnode++)
		{
			string state = npcnode.name();
			if (state == "info")
			{
				node speak = npcnode.resolve("speak");
				if (speak.size() > 0)
				{
					for (node speaknode = speak.begin(); speaknode != speak.end(); speaknode++)
					{
						linenames[state].push_back(speaknode.get_string());
					}
				}
			}
			else
			{
				textures[state] = animation(npcnode);
				node speak = npcnode.resolve("speak");
				if (speak.size() > 0)
				{
					for (node speaknode = speak.begin(); speaknode != speak.end(); speaknode++)
					{
						linenames[state].push_back(speaknode.get_string());
					}
				}
			}
		}

		nx::unview_file("Npc");
		nx::view_file("String");

		node stringdata = nx::nodes["String"].resolve("Npc.img/" + strid);

		node namenode = stringdata.resolve("name");
		if (namenode.data_type() == node::type::string)
			name = namenode.get_string();

		node funcnode = stringdata.resolve("func");
		if (funcnode.data_type() == node::type::string)
			func = funcnode.get_string();

		for (map<string, vector<string>>::iterator stit = linenames.begin(); stit != linenames.end(); stit++)
		{
			string state = stit->first;
			vector<string> names = stit->second;
			for (vector<string>::iterator nit = names.begin(); nit != names.end(); nit++)
			{
				string line = stringdata.resolve(*nit).get_string();
				lines[state].push_back(line);
			}
		}

		nx::unview_file("String");
		nx::view_file("UI");

		node nametagnode = nx::nodes["UI"]["Login.img"]["CharSelect"]["nameTag"];
		vector<texture> ntbg;
		ntbg.push_back(texture(nametagnode.resolve("0/0")));
		ntbg.push_back(texture(nametagnode.resolve("0/1")));
		ntbg.push_back(texture(nametagnode.resolve("0/2")));
		ntag = nametag(app.getfonts()->getfont(DWF_CENTER), txc_yellow, ntbg, name, vector2d());
		ftag = nametag(app.getfonts()->getfont(DWF_CENTER), txc_yellow, ntbg, func, vector2d());

		nx::unview_file("UI");
		app.getimgcache()->unlock();

		oid = o;
		front = fr;
		fh = f;
		position = pos;
		state = "stand";
	}
コード例 #12
0
ファイル: KnownFile.cpp プロジェクト: dreamerc/amule
bool CKnownFile::WriteToFile(CFileDataIO* file)
{
	wxCHECK(!IsPartFile(), false);
	
	// date
	file->WriteUInt32(m_lastDateChanged); 
	// hashset
	file->WriteHash(m_abyFileHash);
	
	uint16 parts = m_hashlist.size();
	file->WriteUInt16(parts);

	for (int i = 0; i < parts; ++i)
		file->WriteHash(m_hashlist[i]);
	
	//tags
	const int iFixedTags = 8;
	uint32 tagcount = iFixedTags;
	if (HasProperAICHHashSet()) {	
		tagcount++;
	}
	// Float meta tags are currently not written. All older eMule versions < 0.28a have 
	// a bug in the meta tag reading+writing code. To achive maximum backward 
	// compatibility for met files with older eMule versions we just don't write float 
	// tags. This is OK, because we (eMule) do not use float tags. The only float tags 
	// we may have to handle is the '# Sent' tag from the Hybrid, which is pretty 
	// useless but may be received from us via the servers.
	// 
	// The code for writing the float tags SHOULD BE ENABLED in SOME MONTHS (after most 
	// people are using the newer eMule versions which do not write broken float tags).	
	for (size_t j = 0; j < m_taglist.size(); ++j){
		if (m_taglist[j].IsInt() || m_taglist[j].IsStr()) {
			++tagcount;
		}
	}

	if (m_lastPublishTimeKadSrc) {
		++tagcount;
	}

	if (m_lastPublishTimeKadNotes){
		++tagcount;
	}
	
	// standard tags

	file->WriteUInt32(tagcount);
	
	// We still save the unicoded filename, for backwards
	// compatibility with pre-2.2 and other clients.
	CTagString nametag_unicode(FT_FILENAME, GetFileName().GetRaw());
	// We write it with BOM to kep eMule compatibility
	nametag_unicode.WriteTagToFile(file,utf8strOptBOM);	
	
	// The non-unicoded filename is written in an 'universial'
	// format, which allows us to identify files, even if the 
	// system locale changes.
	CTagString nametag(FT_FILENAME, CPath::ToUniv(GetFileName()));
	nametag.WriteTagToFile(file);
	
	CTagIntSized sizetag(FT_FILESIZE, GetFileSize(), IsLargeFile() ? 64 : 32);
	sizetag.WriteTagToFile(file);
	
	// statistic
	uint32 tran;
	tran=statistic.alltimetransferred & 0xFFFFFFFF;
	CTagInt32 attag1(FT_ATTRANSFERRED, tran);
	attag1.WriteTagToFile(file);
	
	tran=statistic.alltimetransferred>>32;
	CTagInt32 attag4(FT_ATTRANSFERREDHI, tran);
	attag4.WriteTagToFile(file);

	CTagInt32 attag2(FT_ATREQUESTED, statistic.GetAllTimeRequests());
	attag2.WriteTagToFile(file);
	
	CTagInt32 attag3(FT_ATACCEPTED, statistic.GetAllTimeAccepts());
	attag3.WriteTagToFile(file);

	// priority N permission
	CTagInt32 priotag(FT_ULPRIORITY, IsAutoUpPriority() ? PR_AUTO : m_iUpPriority);
	priotag.WriteTagToFile(file);

	//AICH Filehash
	if (HasProperAICHHashSet()) {
		CTagString aichtag(FT_AICH_HASH, m_pAICHHashSet->GetMasterHash().GetString());
		aichtag.WriteTagToFile(file);
	}

	// Kad sources
	if (m_lastPublishTimeKadSrc){
		CTagInt32 kadLastPubSrc(FT_KADLASTPUBLISHSRC, m_lastPublishTimeKadSrc);
		kadLastPubSrc.WriteTagToFile(file);
	}

	// Kad notes
	if (m_lastPublishTimeKadNotes){
		CTagInt32 kadLastPubNotes(FT_KADLASTPUBLISHNOTES, m_lastPublishTimeKadNotes);
		kadLastPubNotes.WriteTagToFile(file);
	}
	
	//other tags
	for (size_t j = 0; j < m_taglist.size(); ++j){
		if (m_taglist[j].IsInt() || m_taglist[j].IsStr()) {
			m_taglist[j].WriteTagToFile(file);
		}
	}
	return true;
}
コード例 #13
0
	charselect::charselect(char cslots, vector<maplechar>* chars)
	{
		app.getimgcache()->clearcache(ict_login);
		app.getimgcache()->setmode(ict_login);
		nl::nx::view_file("UI");

		node login = nl::nx::nodes["UI"].resolve("Login.img");
		node charsel = login.resolve("CharSelect");

		sprites.push_back(sprite(animation(login.resolve("Title/worldsel")), vector2d()));
		sprites.push_back(sprite(animation(login.resolve("Common/frame")), vector2d(400, 290)));
		sprites.push_back(sprite(animation(login.resolve("Common/selectWorld")), vector2d(580, 42)));
		sprites.push_back(sprite(animation(charsel.resolve("selectedWorld/icon/15")), vector2d(580, 42)));
		sprites.push_back(sprite(animation(charsel.resolve("selectedWorld/name/15")), vector2d(580, 42)));
		sprites.push_back(sprite(animation(charsel.resolve("selectedWorld/ch/" + to_string(app.getui()->getfield()->getchannel()))), vector2d(580, 42)));
		sprites.push_back(sprite(animation(charsel.resolve("charInfo")), vector2d(662, 355)));

		buttons.insert(make_pair(BT_ARBEIT, button(charsel.resolve("arbeit"), 580, 115)));
		buttons.insert(make_pair(BT_CHARCARD, button(charsel.resolve("characterCard"), 665, 115)));

		buttons.insert(make_pair(BT_NEWCHAR, button(charsel.resolve("BtNew"), 200, 495)));
		buttons.insert(make_pair(BT_DELCHAR, button(charsel.resolve("BtDelete"), 320, 495)));

		buttons.insert(make_pair(BT_SELCHAR, button(charsel.resolve("BtSelect"), 586, 427)));

		for (char i = chars->size(); i < cslots; i++)
		{
			sprites.push_back(sprite(animation(charsel.resolve("buyCharacter")), vector2d(130 + (120 * (i % 4)), 250 + (200 * (i > 3)))));
		}

		node nametagnode = charsel["nameTag"];
		pair<vector<texture>, vector<texture>> nttextures;
		nttextures.first.push_back(texture(nametagnode.resolve("0/0")));
		nttextures.first.push_back(texture(nametagnode.resolve("0/1")));
		nttextures.first.push_back(texture(nametagnode.resolve("0/2")));
		nttextures.second.push_back(texture(nametagnode.resolve("1/0")));
		nttextures.second.push_back(texture(nametagnode.resolve("1/1")));
		nttextures.second.push_back(texture(nametagnode.resolve("1/2")));

		for (char i = 0; i < chars->size(); i++)
		{
			nametag charname = nametag(app.getfonts()->getfont(DWF_CENTER), TXC_WHITE, nttextures, chars->at(i).getstats()->name, vector2d(55 + (120 * (i % 4)), 250 + (200 * (i > 3))), (i == 0));
			nametags.push_back(charname);
			buttons.insert(make_pair(BT_CHAR0 + i, button(105 + (120 * (i % 4)), 170 + (200 * (i > 3)), 50, 80)));
			buttons[BT_CHAR0].setstate("pressed");
		}

		app.getimgcache()->unlock();
		app.getimgcache()->setmode(ict_sys);

		lvset = charset(charsel.resolve("lv"));
		statset = charset(nl::nx::nodes["UI"].resolve("StatusBar2.img/mainBar/gauge/number"));

		nl::nx::unview_file("UI");
		nl::nx::view_file("Character");

		for (char i = 0; i < chars->size(); i++)
		{
			maplelook* plook = chars->at(i).getlook();
			app.getlookfactory()->loadcharlook(plook);

			maplelook look = chars->at(i).copylook();
			look.setposition(vector2d(130 + (120 * (i % 4)), 250 + (200 * (i > 3))));
			look.setfleft(false);
			if (i == 0)
			{
				look.setstate("walk1");
				selected = i;
			}
			looks.push_back(look);
			stats.push_back(chars->at(i).getstats());
		}

		nl::nx::unview_file("Character");
		app.getimgcache()->unlock();
		position = vector2d(0, 0);
		dimensions = vector2d(800, 600);
		active = true;
		visible = true;
	}