SkinVersion.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <precomp.h>
  2. #include "SkinVersion.h"
  3. #include "../xml/obj_xml.h"
  4. #include <api/service/waservicefactory.h>
  5. #include <bfc/string/StringW.h>
  6. void LoadXmlFile(obj_xml *parser, const wchar_t *filename);
  7. SkinVersionXmlReader::SkinVersionXmlReader(const wchar_t *skinname)
  8. {
  9. waServiceFactory *parserFactory = WASABI_API_SVC->service_getServiceByGuid(obj_xmlGUID);
  10. if (parserFactory)
  11. {
  12. obj_xml *parser = (obj_xml *)parserFactory->getInterface();
  13. if (parser)
  14. {
  15. parser->xmlreader_registerCallback(L"WinampAbstractionLayer", this);
  16. parser->xmlreader_registerCallback(L"WasabiXML", this);
  17. parser->xmlreader_open();
  18. StringPathCombine fn(WASABI_API_SKIN->getSkinPath(), L"skin.xml");
  19. LoadXmlFile(parser, fn);
  20. parser->xmlreader_unregisterCallback(this);
  21. parser->xmlreader_close();
  22. parserFactory->releaseInterface(parser);
  23. parser = 0;
  24. }
  25. }
  26. }
  27. void SkinVersionXmlReader::xmlReaderOnStartElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params)
  28. {
  29. const wchar_t *version = params->getItemValue(L"version");
  30. if (version)
  31. walversion = version;
  32. }
  33. const wchar_t *SkinVersionXmlReader::getWalVersion()
  34. {
  35. return walversion;
  36. }