aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/ASXv2.cpp
blob: e509d85a8a3d1a8d51ff307e33bff9745f708453 (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
43
44
45
/** (c) Nullsoft, Inc.         C O N F I D E N T I A L
 ** Filename: 
 ** Project:
 ** Description:
 ** Author: Ben Allison benski@nullsoft.com
 ** Created:
 **/
#include "main.h"

void loadasxv2fn(const wchar_t *filename, int whattodo)
{
	if (PlayList_getlength())
	{
		if (whattodo < 1)
			PlayList_delete();
	}

	int i=1;
	wchar_t ref[FILENAME_SIZE];
	wchar_t key[100];
	while (1)
	{
		StringCchPrintfW(key, 100, L"Ref%d", i++);
		GetPrivateProfileStringW(L"Reference", key, L"?", ref, FILENAME_SIZE, filename);
		if (!lstrcmpiW(ref, L"?"))
		break;
		else
		{
				if (!_wcsnicmp(ref, L"http://", 7))
				{
					wchar_t *end = scanstr_backW(ref, L"/.", 0);
					if (!end || *end == L'/')
					{
						if (wcschr(ref, L'?'))
							StringCchCatW(ref, FILENAME_SIZE, L"&=.wma");
						else
								StringCchCatW(ref, FILENAME_SIZE, L"?.wma");
					}
				}

			PlayList_append(ref);
		}

	}
}