Subversion Repositories spk

Rev

Rev 75 | Rev 162 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#include "../StdAfx.h"
2
#include "DownloadPackageList.h"
3
 
75 cycrow 4
namespace PluginManager {
5
 
6
DownloadPackageList::DownloadPackageList(CPackages *p, CyStringList *servers)
7
{
8
	InitializeComponent();
9
 
10
	m_pPackages = p;
11
	m_pServers = servers;
12
	m_pCurrentServer = NULL;
13
	m_iServerPos = 0;
14
}
15
 
16
void DownloadPackageList::NextServer()
17
{
18
	if ( !m_pCurrentServer )
19
	{
20
		m_pCurrentServer = m_pServers->Head();
21
		m_iServerPos = 1;
22
	}
23
	else
24
	{
25
		m_pCurrentServer = m_pCurrentServer->next;
26
		++m_iServerPos;
27
	}
28
 
29
	// last server done
30
	if ( !m_pCurrentServer )
31
	{
32
		Finished();
33
		return;
34
	}
35
 
36
	this->label2->Text = Convert::ToString(m_iServerPos) + " / " + Convert::ToString(m_pServers->Count());
37
	this->label3->Text = SystemStringFromCyString(m_pCurrentServer->str);
38
 
39
	this->backgroundWorker1->RunWorkerAsync();
40
}
41
 
42
void DownloadPackageList::Finished()
43
{
44
	Close();
45
}
46
 
47
void DownloadPackageList::ExtractWebData(String ^data)
48
{
49
	cli::array<String ^> ^lines = data->Split('\n');
50
	if ( lines )
51
	{
52
		 for ( int i = 0; i < lines->Length; i++ )
161 cycrow 53
			 m_pPackages->parseAvailablePackage(_S(lines[i]).remove(9).remove('\r'), m_pCurrentServer->str.ToString());
75 cycrow 54
	}
55
}
56
 
57
 
58
}