aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/skin/SkinVersion.cpp
blob: ae112c49414b3e980b52e45b07583ca16bb2fcb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <precomp.h>
#include "SkinVersion.h"
#include "../xml/obj_xml.h"
#include <api/service/waservicefactory.h>
#include <bfc/string/StringW.h>

void LoadXmlFile(obj_xml *parser, const wchar_t *filename);

SkinVersionXmlReader::SkinVersionXmlReader(const wchar_t *skinname)
{
	waServiceFactory *parserFactory = WASABI_API_SVC->service_getServiceByGuid(obj_xmlGUID);
	if (parserFactory)
	{
		obj_xml *parser = (obj_xml *)parserFactory->getInterface();

		if (parser)
		{
			parser->xmlreader_registerCallback(L"WinampAbstractionLayer", this);
			parser->xmlreader_registerCallback(L"WasabiXML", this);
			parser->xmlreader_open();

			StringPathCombine fn(WASABI_API_SKIN->getSkinPath(), L"skin.xml");
			LoadXmlFile(parser, fn);
			parser->xmlreader_unregisterCallback(this);

			parser->xmlreader_close();
			parserFactory->releaseInterface(parser);
			parser = 0;
		}
	}
}

void SkinVersionXmlReader::xmlReaderOnStartElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params)
{
	const wchar_t *version = params->getItemValue(L"version");
	if (version)
		walversion = version;
}
const wchar_t *SkinVersionXmlReader::getWalVersion()
{
	return walversion;
}