1
0

asx.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author: Ben Allison [email protected]
  6. ** Created:
  7. **/
  8. #include "main.h"
  9. #include "asx.h"
  10. #include "../jnetlib/api_httpget.h"
  11. #include "../nu/AutoChar.h"
  12. #include "WinampPlaylist.h"
  13. #include "../nu/AutoWide.h"
  14. #include "api.h"
  15. #if 0 // keep around for reference
  16. void ASXLoader::LoadFile(const char *filename)
  17. {
  18. HANDLE file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
  19. if (file == INVALID_HANDLE_VALUE)
  20. return ;
  21. char data[1024];
  22. DWORD bytesRead;
  23. // check for ASXv2
  24. if (ReadFile(file, data, 11, &bytesRead, NULL) && bytesRead)
  25. {
  26. if (bytesRead == 11 && !_strnicmp((char *)data, "[Reference]", 11))
  27. {
  28. loadasxv2fn(filename, 1); // can pass 0 since loadasxfn() already took care of this
  29. CloseHandle(file);
  30. return ;
  31. }
  32. }
  33. else
  34. {
  35. CloseHandle(file);
  36. return ;
  37. }
  38. if (!parser)
  39. {
  40. CloseHandle(file);
  41. return ;
  42. }
  43. GayASX_to_XML_converter(parser, data, bytesRead); // read the small amount we read when sniffing for asxv2
  44. while (true)
  45. {
  46. if (ReadFile(file, data, 1024, &bytesRead, NULL) && bytesRead)
  47. GayASX_to_XML_converter(parser, data, bytesRead);
  48. else
  49. break;
  50. }
  51. CloseHandle(file);
  52. parser->xmlreader_feed(0, 0);
  53. }
  54. #endif