static void get3secfile(object name)
{
string baseurl1sec = "http://firmware.ardupilot.org/SRTM/USGS/SRTM1/version2_1/SRTM1/";
string baseurl = "http://firmware.ardupilot.org/SRTM/";
// check file doesnt already exist
if (File.Exists(datadirectory + Path.DirectorySeparatorChar + (string) name))
{
FileInfo fi = new FileInfo(datadirectory + Path.DirectorySeparatorChar + (string) name);
if (fi.Length != 0)
return;
}
int checkednames = 0;
List<string> list = new List<string>();
// load 1 arc seconds first
//list.AddRange(getListing(baseurl1sec));
// load 3 arc second
list.AddRange(getListing(baseurl));
foreach (string item in list)
{
List<string> hgtfiles = new List<string>();
hgtfiles = getListing(item);
foreach (string hgt in hgtfiles)
{
checkednames++;
if (hgt.Contains((string) name))
{
// get file
gethgt(hgt, (string) name);
return;
}
}
}
// if there are no http exceptions, and the list is >= 20, then everything above is valid
// 15760 is all srtm3 and srtm1
if (list.Count >= 12 && checkednames > 14000 && !oceantile.Contains((string) name))
{
// we must be an ocean tile - no matchs
oceantile.Add((string) name);
}
}