private void Downloader()
{
if (b_endit == true)
{
System.Environment.Exit(0);
}
GetFilesCount();
bool b_dzfirst = true;
for (int i = 0; i < i_DateiAnzahl; i++)
{
if (File.Exists(s_AppPath + "/" + s_MatchID + "/" + "game_" + i.ToString() + ".dat") == false)
DLgameFile(i);
Application.DoEvents();
}
#region Check der Dateianzahl
int i_zahltest = 0;
while (true)
{
Thread.Sleep(1000);
if (i_DateiAnzahl < 20)
{
b_buffer = true;
while (true)
{
Thread.Sleep(1000);
GetFilesCount();
if (Directory.Exists(s_AppPath + " / " + s_MatchID))
{
string[] dd = Directory.GetFiles(s_AppPath + " / " + s_MatchID + " / ");
i_zahltest = dd.Length;
}
if (i_zahltest >= 20 && b_dzfirst == true)
{
for (int i = 0; i < i_DateiAnzahl; i++)
{
if (File.Exists(s_AppPath + "/" + s_MatchID + "/" + "game_" + i.ToString() + ".dat") == false)
DLgameFile(i);
Application.DoEvents();
}
thread_read = new Thread(new ThreadStart(Reader));
thread_read.Start();
break;
}
}
}
else
{
GetFilesCount();
b_buffer = false;
if (b_dzfirst)
{
thread_read.Start();
b_dzfirst = false;
}
for (int i = 0; i < i_DateiAnzahl; i++)
{
if (File.Exists(s_AppPath + "/" + s_MatchID + "/" + "game_" + i.ToString() + ".dat") == false)
DLgameFile(i);
Application.DoEvents();
}
}
Application.DoEvents();
}
#endregion
}